The Book of AI

How To Build Chatbots with The Personality Forge
Chapters
Chapter 6: Keyphrase Rank
Rank Bonuses

Often, several Keyphrases or Seeks will match something in a message. The AI Engine has a complex internal algorithm that determines which Keyphrase is best by calculating the Rank of each match. It considers the length of the match, the position in the sentence, context in the conversation, and several other factors. Rarely, you may want to give certain Keyphrases a boost. You can do this by giving it a Rank bonus, which increases the chance it will be selected above others. The range for Ranks is from 1 to 100, but it is usually best to leave it at 0 and let the AI Engine take care of making the best choice.

Using Debug is a great way to see which Keyphrases are matching and what their final calculated Rank is in different situations. If you need to adjust a Rank, you can use this to see what kind of number to give it as its Rank bonus. Here are some good reasons to add Rank bonuses.

  1. If you want to ignore what was said and have a Keyphrase that matches bad words or unwanted topics, you could give something a rank of 50 - 100 and if it can match, it will always match.
  2. Topics that are important to your Bot can be given a bonus of 25 - 50. But be careful not to just give bonuses to topic words. If you Bot likes the beach, giving a bonus to a Keyphrase "beach" will make your bot miss the context of the question. "do you like * beach" would be a better Keyphrase than just giving a bonus to a Keyphrase of "beach".
  3. Small bonuses of 1 - 10 are sometimes necessary so that slightly shorter Keyphrases with different kinds of Wildcards are chosen before others. This should only be done on rare occasions, after looking at the Rank values in Debug mode.
OutRanking a Seek

Seeks gets am automatic Rank bonus of 25, meaning they almost always beat out the general Keyphrases. Giving another Keyphrase a Rank Bonus of 50 - 100 is enough to overcome even the Rank of a Seek. So if you have a Keyphrase for unwanted words or topics and it has a Rank of 100, it will even take precedence over a Seek match.