If you do have a list of words, you could put them into an entity for offensive words. Then, when you ask for the user's name, FIRST check that list, if its offensive, skip, if not offensive, capture whatever they say. You could add additional checks for things like more than 3 words, etc., if you want as well using this same pattern.
If you want to go Tox's route, you would collect whatever they say, send it off the web hook check if its offensive, if so, your web hook will return a new result variable that you could just use instead of $name, or overwrite $name with that, etc so you don't use the bad word.
This is something that has come up here and there, but has not really proven to be a major problem for most customers who have a use case that people take seriously. If its a Facebook personality bot like a Bart Simpson or something, of course people say all kinds of wild things just for fun/mischief like you said, but in most "real" use cases I don't see this very commonly.
------------------------------
Mitch Mason
------------------------------
Original Message:
Sent: Wed September 02, 2020 11:16 AM
From: Eoin Kennedy
Subject: Avoiding offensive language when using $name
Thanks Daniel. I assume that after it correctly registers the name as an offensive word I would need to insert some code to not say Hi <offensive word>. I have done a bit of searching but have not found an obvious solution and thought it might have been an obvious one that chatbot builders would have come across. The 'Hi there' is certainly safer.
------------------------------
Eoin Kennedy
Original Message:
Sent: Wed September 02, 2020 11:09 AM
From: Daniel Toczala
Subject: Avoiding offensive language when using $name
Hello Eoin,
One of the simplest ways to avoid this is to just say, "Hello there!", instead of, "Hello Tox" or "Hello Bob". You mentioned that you wanted to give your virtual assistant some personality and friendliness, so this probably isn't a satisfying solution for you. I know that there are collections of "offensive words" out there, I know that our local automobile licensing authority uses them to screen for offensive license plate requests. There are commercial things (like Cleanspeak - https://cleanspeak.com/), and Python libraries (like profanity filter - https://pypi.org/project/profanity-filter/). You would call these using a webhook, and you could check for profanity in user names, as well as in any user request, and respond accordingly.
------------------------------
Daniel Toczala
Community Leader and Customer Success Manager - Watson
dtoczala@us.ibm.com
Original Message:
Sent: Wed September 02, 2020 08:01 AM
From: Eoin Kennedy
Subject: Avoiding offensive language when using $name
Hi all,
Apologies if this is the wrong forum to ask this question. I have built a fairly basic chatbot using Watson Assistant for an event www.congregation.ie. As part of the welcome I ask people what name I can call them by using $name. It works as it should and greets them by their name but worried about people using offensive names and screen grabbing it - out of mischief rather than anything else. Is there any way to ignore certain obvious offensive language words and continue the dialogue as normal - ie blank instead of hello name or other responses mechanisms?
Eoin
------------------------------
Eoin Kennedy
------------------------------
#WatsonAssistant