# Preprocess user input

**URL:** <https://forum.rasa.com/t/preprocess-user-input/14001>\
**Category:** Rasa Open Source\
**Created:** [August 6, 2019, 12:44pm UTC](https://forum.rasa.com/t/preprocess-user-input/14001 "2019-08-06T12:44:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lampeska](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/lampeska/32/2820_2.png) [@lampeska](https://forum.rasa.com/u/lampeska)\
**Post date:** [August 6, 2019, 12:44pm UTC](https://forum.rasa.com/t/preprocess-user-input/14001/1 "2019-08-06T12:44:06Z")

</div>

Hello everybody, I am new to Rasa and I have a question how to best structure my application. Before Rasa should check the message for intents, I want to check if there are spelling errors in the users input. If there are errors -\> send the possible corrections to user. I am going to use LanguageTool for spellchecks. For communication between client and server I use websockets, which are already working.

My questions now are:

- how can I achieve the LanguageTool part? Do I need to setup a custom component? Or an extra server/service between client and rasa-server?
- if I want to add more [Socket.io](http://Socket.io) events, how can I do that? By default only “user\_uttered” and “bot\_uttered” are available, right? I would like to have an event which is triggered when there’s spelling errors.

Thank you very much for your help!

---

<div class="post-metadata">

**Author:** ![msamogh](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/msamogh/32/3478_2.png) [@msamogh](https://forum.rasa.com/u/msamogh)\
**Post date:** [August 7, 2019, 8:16am UTC](https://forum.rasa.com/t/preprocess-user-input/14001/2 "2019-08-07T08:16:58Z")

</div>

I see 2 situations why you would want to offer spelling suggestions:

1. **The spelling error is preventing Rasa NLU from detecting the intent correctly**   
In this case, you can classify it as an unknown intent and handle it in a custom action later on.
2. **The intent is classified correctly**  
Even here, you can use a custom action to set a slot like `misspelt` to True and handle it inside a custom action again.

Is there any reason this doesn’t work for you?

---

<div class="post-metadata">

**Author:** ![lampeska](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/lampeska/32/2820_2.png) [@lampeska](https://forum.rasa.com/u/lampeska)\
**Post date:** [August 12, 2019, 6:36am UTC](https://forum.rasa.com/t/preprocess-user-input/14001/3 "2019-08-12T06:36:24Z")

</div>

Thanks for your quick answer Amogh. The reason why I am offering spelling suggestion is that I am implementing a bot to learn English with. So it is essential to know when there are mistakes in the sentence.

I now managed to solve the problem by checking the sentence for language errors in the [socket.io](http://socket.io) input channel specifically in the method `async def handle_message(sid, data)` . Here I can call the languagetool endpoint.

The second part of my question I also managed to solve. Again I customized the [socket.io](http://socket.io) `InputChannel`. Socket events can be added here in the ` __init__ ` function and by defining a method that is registered as a socket event.

---

<div class="post-metadata">

**Author:** ![ermarkar](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/ermarkar/32/13716_2.png) [@ermarkar](https://forum.rasa.com/u/ermarkar)\
**Post date:** [March 9, 2021, 5:43am UTC](https://forum.rasa.com/t/preprocess-user-input/14001/4 "2021-03-09T05:43:10Z")

</div>

i have pre processing pipeline that i want user input to process through. So is there any interceptor kind of thing to do manipulation on user input while sending the user input to rasa?
