How To Build Chatbots

on The Personality Forge
Chapter 9: 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. 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.

On very rare occasions, 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.

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 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. But for the most part, this is handled best through setting your account's "Approved Ratings" in Settings.
  2. 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 an 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.