# How to handle punctuation and symbol in rasa?

**URL:** <https://forum.rasa.com/t/how-to-handle-punctuation-and-symbol-in-rasa/19454>\
**Category:** Rasa Open Source\
**Created:** [October 8, 2019, 1:24pm UTC](https://forum.rasa.com/t/how-to-handle-punctuation-and-symbol-in-rasa/19454 "2019-10-08T13:24:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![piyush29programmer](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/piyush29programmer/32/4050_2.png) [@piyush29programmer](https://forum.rasa.com/u/piyush29programmer)\
**Post date:** [October 8, 2019, 1:24pm UTC](https://forum.rasa.com/t/how-to-handle-punctuation-and-symbol-in-rasa/19454/1 "2019-10-08T13:24:43Z")

</div>

Rasa version - 1.3.7

pipeline: “supervised\_embeddings”

Hi All,

I have trained the bot with no punctuation in intent like.

> ` ## intent: ask_holiday_in_a_year`

> ```
> How many holidays do we have in a year?
> 
> ```

If i ask below question to bot

1. **How many holidays do we have in a year?** - ( NLU is able to recognize it correctly).

2. **How, many ()? Holidays!!,do!@#we have$%^ in a %^& year.** - (NLU is able to recognize it correctly.)

3. **How many ###################### holidays do we have in a year?**.(NLU is not able to recognize it correctly.)

4. **How many ####### holidays %%^&\*$$% do we have in a year?**.(NLU is not able to recognize it correctly.)

For cases 1 and 2, it worked but for case 3 and 4, it didn’t work? Is there any way(adding some settings in the pipeline)i can handle these symbols and punctuation and give the expected result?

---

<div class="post-metadata">

**Author:** ![Gehova](https://avatars.discourse-cdn.com/v4/letter/g/2acd7d/32.png) [@Gehova](https://forum.rasa.com/u/Gehova)\
**Post date:** [October 8, 2019, 1:51pm UTC](https://forum.rasa.com/t/how-to-handle-punctuation-and-symbol-in-rasa/19454/2 "2019-10-08T13:51:51Z")

</div>

You could delete the symbols at the beginning of the pipeline with a [custom nlu component](https://rasa.com/docs/rasa/api/custom-nlu-components/). In the third parameter of the maketrans function, add the symbols you want to delete.

```auto
from rasa.nlu.components import Component
import typing
from typing import Any, Optional, Text, Dict

if typing.TYPE_CHECKING:
    from rasa.nlu.model import Metadata

    class DeleteSymbols(Component):

        provides = ["text"]
        #requires = []
        defaults = {}
        language_list = None

        def __init__ (self, component_config=None):
            super(DeleteSymbols, self). __init__ (component_config)

        def train(self, training_data, cfg, **kwargs):
            pass

        def process(self, message, **kwargs):
            mt = message.text
            message.text = mt.translate(mt.maketrans('', '', '$%&(){}^'))

        def persist(self, file_name: Text, model_dir: Text) -> Optional[Dict[Text, Any]]:
            pass

        @classmethod
        def load(
            cls,
            meta: Dict[Text, Any],
            model_dir: Optional[Text] = None,
            model_metadata: Optional["Metadata"] = None,
            cached_component: Optional["Component"] = None,
            **kwargs: Any
        ) -> "Component":
            """Load this component from file."""

            if cached_component:
                return cached_component
            else:
                return cls(meta)

```

---

<div class="post-metadata">

**Author:** ![piyush29programmer](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/piyush29programmer/32/4050_2.png) [@piyush29programmer](https://forum.rasa.com/u/piyush29programmer)\
**Post date:** [October 10, 2019, 2:15am UTC](https://forum.rasa.com/t/how-to-handle-punctuation-and-symbol-in-rasa/19454/3 "2019-10-10T02:15:28Z")

</div>

@Gehova thanks a lot for providing the code and it worked.
