How do I handle the special character '/' in rasa?

For example, the following sentence: “hi good afternoon how are you doing”. The intent of this joke is ‘greet’. When I request the API of ‘model / parse’, it will return the correct intent and entity. But when I add the special character ‘/’ in front of this sentence, such as: “/ hi good afternoon how are you doing”, the intention returned by ‘model / parse’ is ‘/ hi good afternoon how are you doing’ instead of ‘greet’. I read the source code of rasa, as follows: %E5%9B%BE%E7%89%87

How do I deal with the special character ‘/’ to take into account the RegexInterpreter of the source code and I cite this example? It is best to solve it without modifying the source code. Please help me, thanks.

May I know please, why would you want to insert ‘/’ in front of normal messages?

This need to make our products needs to start with ‘/’ when talking to rasa. Even without considering the needs of the product, it is impossible to avoid people not adding ‘/’ during the dialogue.

Is it possible for you to intercept the message at connector level and remove the ‘/’ from the message before sending it to rasa? What channel are you using for communicating with users?

I communicate with the user through a custom channel, but now I only need the NLU function, not the core function. My current approach is that after the rasa service (including NLU and core) is started, I reload the model in the custom channel, but this is equivalent to loading the model twice. Is there a better way?

This doc could help you in using only NLU. If you are using only NLU then you can either intercept the message at connector and remove the ‘/’ before sending it to NLU or you can write a custom component to do the same at the beginning of the pipeline.

Thank you very much.

  1. It seems that it is not feasible to use Custom NLU Components. Because rasa.core.processor._parse_message is executed before calling NLU Components.
  2. I can remove the ‘/’ in the custom connectors, but how can I directly call the relevant interface of NLU in the custom connetors? I tried ‘requests’ calling the ‘model / parse’ interface, but I could not connect.