Search code examples
chatbotazure-cognitive-servicesazure-language-understanding

How does Microsoft LUIS filter swear words?


We've been using Microsoft's LUIS cognitive service as an ML tool for our Chatbot. We've observed that whenever there is a swear word entered, there is no response from the bot. I couldn't find anything about this in the documentations, except that LUIS can identify slang words. I would also like to know if anyone knows how to customize your Chatbot's response in such a scenario?

Any help would be great. Thank you!


Solution

  • LUIS doesn't filter swearwords. Regarding an explanation for the lack of response from your chatbot, it would be necessary to see the code for the bot. If the user isn't in a dialog and utters a swearword, your bot should either map it to a defined intent, map it to the crowd-favorite "None" intent, or do nothing with it. To my knowledge the only time the chatbot will do nothing, is when a handler for the "None" intent isn't defined.

    To handle an utterance that contains swearwords it's necessary to know the context behind it.

    At certain points, the SDK you're using may block swearwords indirectly. E.g. a user saying, "#$%! yes!" to a confirm prompt may have the bot asking the user to repeat themselves with either a yes or no response.

    An extremely simple and intrusive way to handle swear words in the Node SDK would be to create a bot.dialog() that activates through the use of .triggerAction(). You can use regexp so the chatbot responds to swearwords by switching to this dialog. You can also use a custom Intent Recognizer to recognize swearwords.