Tutorial

Expert-Chatbot Aileen – Part 2 – Surpassing Exact Matches

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.

  • black
  • color

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:

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.

We also prepared a short example in javascript to see the overall code.

Open in new window

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.