How to handle profanity inputs in Dialogflow ES

I got this question from a student:

I need your help in one of the logic. How to handle profanity inputs in the dialogflow es in the best way. Can you suggest some best approaches.

Here is one way to do it.

Declare an entity with a list of profane words. I will use some fairly mild words for this example.

Create an intent to handle the profane input.

The key is to use the wildcard entity to create training phrases to handle any word/phrase appearing before and after the profane term.

The training phrase below handles random input before the profane word

Handle any word or phrase after the profane term:

Handle profane word alone:

Handle random phrase before and after the profane word:

Add a suitable response message:

Now test it:

This will usually handle all the profane words that you have already listed in the entity, but it will miss the ones which you did not add to the list.

Occasionally, you might also run into false positives where the user inputs a single profane word as part of a genuine intent.


About this website

I created this website to provide training and tools for non-programmers who are building Dialogflow chatbots.

I have now changed my focus to Vertex AI Search, which I think is a natural evolution from chatbots.

Note

BotFlo was previously called MiningBusinessData. That is why you see that watermark in many of my previous videos.

Leave a Reply