The last time, we discovered what Chatbots and Expert-Bots are made for. We learned, that there are several question, which are tough to answer for AIs and we saw, that most of the time Expert-Bots consist of a question/answer database. However there is one major drawback for now. We only search for sentences with exact match. But it is very unlikely, that a random person, who does not know the code and knowledge-base behind a bot, will ask the exact same question. If someone asks for “Is black a color?”, this can be rephrased in different ways:
- Is black a color?
- Does black belong to colors?
- Black is not a color, is it?
All these questions kind of ask the same. However using the current approach, we would have to put every possible sentence in our database, which would result in an endless amount of predefined sentences. Instead we focus on the words these sentences have in common.
Whenever Aileen faces a sentence, which contains both words she will give a predefined answer. The predefined answer should be as general as possible. A straight-forward answer would be: “No”
But this offers some problems whenever the user does not ask a question like “My favorite color is black”. Now answering with “No” would let Aileen look very dumb. Therefore we choose a more general answer: “Black is no color.”
This gives in many situations a good answer, even though sometimes the answer may look picky, at least Aileen does not look like a stupid bot.
In Pseudo-Code this may look like the following:
if(userMessage.contains("black") && userMessage.contains("color"))
return "Black is no color.";
// else if ...
This of course causes some other problems to appear. Similar questions may now get answered by the same if. This can be easily overcome by checking at first for the most specific answers and get more general the less the specific answers fit. Later on we will have a closer look at this technique and how to improve it. For the next part have a look at this post.