Create a keyword question

Create a keyword question when you want to exactly match a specific phrase or word in the user's reply. For example:

  • Users saying hi, hello, hey, or similar greetings.
  • Users swearing or sending other offensive content.
  • Users sending STOP or similar unsubscribe requests.
  • Users sending emoji, images or stickers.

Keyword questions are checked first

The chatbot attempts to match a question by keyword before checking the NLP questions.

You can use keyword questions as either Inbound or Outbound questions. For more information on Inbound and Outbound questions, see Questions.

Weighting and word limits

You can use weightings and word limits to ensure keywords are matched correctly.

Weighting

Sometimes you may have two different questions with very similar keywords that lead to different passages.

You can use weighting to control the order in which keyword questions are checked, to ensure the correct or more important question is matched first. If you give a question a higher weighting, the chatbot will attempt to match that question first before lower-weighted or non-weighted questions.

Word limit

Word limits control the maximum number of words a question can contain and still match that question. If a question has a word limit of 5, a user response that is six words long will not match the question, even if it contains the exact phrase.

Create an Inbound keyword question

To create an Inbound keyword question:

  1. Open the passage you want to create the question in.
  2. Click Inbound Questions.
  3. Choose to create either a Global-level question that will match from anywhere in the chatbot, or a Conversation-level question that will only match within this conversation. See Questions.
  4. Click + Question in your chosen context level.
  5. Click the edit icon next to the New Question title.
  6. Type a descriptive name for the question.
  7. Type the keywords and phrases you want to match in the Training Phrases field. Use a new line for each new keyword or phrase.
  8. If you want to weight the question, turn on Weighting, and type a Weight.
  9. If you want to add a word limit to the question, turn on Word Limit and type the maximum number of words that can match this question in the Maximum Words field.
  10. Click Save.

Create an Outbound keyword question

To create an Outbound keyword question:

  1. Open the passage you want to create the question in.
  2. Click Outbound Questions.
  3. Click + Question.
  4. Click the edit icon next to the New Question title.
  5. Type a descriptive name for the question.
  6. Type the keywords and phrases you want to match in the Training Phrases field. Use a new line for each new keyword or phrase.
  7. If you want to weight the question, turn on Weighting, and type a Weight.
  8. If you want to add a word limit to the question, turn on Word Limit and type the maximum number of words that can match this question in the Maximum Words field.
  9. Select the Conversation of the passage that will answer this question.
  10. Select the Passage that will answer this question.
  11. Click Save.

Improving keyword accuracy

You should periodically review your keyword questions and adjust them accordingly. Consider:

  • Adding or removing training phrases from certain questions.
  • Adding word limits to a question to avoid confusion with another question.
  • Using weighting to control the order in which questions are matched.

Advanced Keywords (Rivescript)

InGenious AI allows the use of Rivescript when matching intents by keywords. Rivescript allows content creators to perform more flexible and powerful operations when matching keyword questions. Similar to word count and weighting, Advanced Keywords (Rivescript) can be enabled per keyword question.

Advanced Keywords do not replace NLP use

Advanced Keywords still only perform exact pattern-based matching, however it extends the syntax to define many phrases using one line. For more information on NLP and Keyword Questions, see Questions.

Tokens

When writing Advanced Keywords, a token refers to groups of characters of which operators are applied to. An operator may be applied to a single or multiple tokens.

Each single character in a phrase is a token, and by default, operators are only applied to one character. To create a token with multiple characters, delimit them with parentheses ().

Rivescript Operators

Wildcards (*)

Wildcards are represented by the * asterisk symbol and it matches any text. 

Example:

If we add both phrases to a question, the question will match phrases containing both the word “missed” and “payment”:

"payment * missed" or "missed * payment"

Things to remember

  • There is no need to add separate-word wildcards at the beginning and end of phrases. Example: “* hello *” is equivalent to “hello”. However, “hello*” is different as it allows extensions of the word hello.
  • “**” is equivalent to “*”

Word Wildcards (_)

Word Wildcards match exactly one alphabetical word (e.g., containing only the letters a-z without spaces), words with non-alphabetical character will not be matched:

Example:

“My name is _” matches “My name is Alice” or “My name is Bob”, but not “My name is HAL9000”

Numeric Wildcards (#)

Numeric Wildcards match an integral number.

Example:

“I am # years old” matches “I am 24 years old”, but does not match “I am 2.4 years old” or “I am twenty years old”.

Unions (|)

A union will match if at least one of the tokens inside the parentheses is matched.

Example:

cook(ing|ed) matches both “cooking” and “cooked”, but does not match “cook”

cook(s|ing|ed) matches all of “cooks”, “cooking”, and “cooked” but does not match “cook”

Things to remember:

  • Do not use unions for whole keyword phrases. Please instead separate your keywords as by default this also performs a union.

Optionals (?)

Indicates that a token is optional.

Example:

"Repay (home)? Loan" matches both “repay loan” and “repay home loan”

"Repay loans?"  matches both “repay loan” and “repay loans”

"cook(s|ing|ed)?" matches “cooks”, “cooking”, “cooked”, and “cook”. The optional applies to the entire preceding token, including the union.



Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.