Присоединяйтесь к Сэп Libre у партнера и партнерскую программу и поддержать нашу бесплатную открытую платформу

What are keywords?

по admin опубликовано Oct 9 2014, 6:51

You can add keywords to a response from the Training & Chat Logs page in your bot's Admin Console.

A keyword is an important word in the question for a specific response.

question: Do you like hockey?
response: Hockey is my favorite sport.
keywords: hockey

question: I love spinach.
response: Spinach is is my favorite food.
keywords: spinach

A keyword will be used by the bot to select the best response. Keywords let some words count for more than other words. For example, suppose the bot knew two responses to similar questions, in general it will select the best response by which question best matches the current question.

question: I love hockey

Normally the bot would probably match this question with "I love spinach", but since hockey is a keyword, it will instead match it with "Do you like hockey?".

If the response has no defined required words, then one of the keywords will also be required for the response match. So "I love hockey" would not be matched with "I love spinach." because it is missing the keyword.

Be careful using too many keywords. If every word is a keyword, then their value is diminished. Never make common words like "the", "a", "he", "what" keywords, if you require one of these words for a match use a required word instead.

You can even add keywords to a match that are not in the original question.

question: What color do you like?
keywords: color colour colors colours collor

This can be useful for adding multiple spellings or verb tenses. If the question contains any of the keywords it will be considered a potential match. If a response should require more than one word for a match, use required words, not keywords.

by ggyyyy posted Jul 26 2017, 0:15
What are required words and how do you use them

Thumbs up: 4, thumbs down: 2, stars: 4.0
Views: 1075, today: 0, week: 9, month: 14

by admin posted Jul 26 2017, 7:03


Thumbs up: 4, thumbs down: 1, stars: 5.0
Views: 1060, today: 0, week: 13, month: 20

by alp-shah posted Oct 1, 8:30

Though mentioning keywords is very useful I find very dangerous too.  e.g. I have 2 questions  

what is life insurance?
this is answer for life insurance

what is standard cover in policy?
answer for standard cover
keywords: standard

This works fine and give answer if someone ask "what is life insurance policy". (Assume I didn't consider adding policy as word in question).

Now I created new question as below to answer generic query related to any insurance policy

what is insurance policy?
Generic answer for insurance policy
keywords: policy

Now as I made policy as keywords, it always picks up when policy comes as word. So if user ask "what is life insurance policy", this last answer will be picked up due to policy keyword giving it more priority. How do I handle this?  While writing last question I might not realize that it will impact my previous questions.

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 69, today: 0, week: 10, month: 16

by admin posted Oct 2, 7:59

Note that, "what is life insurance policy" equally matches "what is life insurance" and "what is insurance policy", so even without the keyword, the bot may use either response.

I would recommend you also add "life" as a keyword to the first response.

Also, if you want "what is life insurance policy" to use the first response then add it as a valid question for this label as well.

what is life insurance
Answer for life insurance
keyword: life
label: #lifeinsurance

what is life insurance policy

what is standard cover in policy
answer for standard cover
keywords: standard
label: #standardcover

what is insurance policy
Generic answer for insurance policy
keywords: policy
label: #policy

Thumbs up: 1, thumbs down: 0, stars: 5.0
Views: 77, today: 0, week: 9, month: 15

by alp-shah posted Oct 3, 2:18


Thanks for quick reply.

I see 2 changes in your suggestion.  1) Additional question with "policy" word added and 2) set "life" as keyword (which should be in both question I think).

With these changes, now it will work fine. However, my point is how do I avoid such regression?

Earlier I had just first 2 questions in script file. Without having question  "what is insurance policy?" in script file, below were answers

what is life insurance policy?
      Answer for life insurance
what is life insurance?
      Answer for life insurance
what is insurance?
      Answer for life insurance
what is insurance policy?
      Answer for life insurance

I find that i should give answer for life insurance only if explicitly asked otherwise I should give generic answer. So to handle 3rd & 4th case, I added question related to generic answer and after that situation changed as below (without applying your suggestion)

what is life insurance policy?
       Generic answer for insurance policy  (due to policy as keyword this wrong answer was chosen)
what is life insurance?
      Answer for life insurance (expected answer as policy word not used)
what is insurance?
      Answer for life insurance (no generic answer as required word policy missing)
what is insurance policy?
      Generic answer for insurance policy (correctly handled)

So addition of new question altered answer for "what is life insurance policy?". This is kind of regression which I might not able to test. If I have thousands of questions, it is difficult to find such regression. I can obviously modify earlier question and add "life" as keyword as suggested by you but when you have thousands of question, it is difficult to visualize impact and revisit all questions again when you add new questions to your script. I wish to know how would you handle such situations? Any best practice or recommendation of automatic test case ?


Updated: Oct 3, 2:22
Thumbs up: 1, thumbs down: 0, stars: 5.0
Views: 114, today: 0, week: 13, month: 26

by admin posted Oct 3, 13:05

Even without keywords, adding new response will affect what response a bot chooses, if the new response better matches a question by the user.

A response will always be used for the question it was add for, but for similar questions the bot will always try to find the best matching response. To have a response used for many variations of a question, define an intent label for the response and add it as the response for the valid variations.

Thumbs up: 1, thumbs down: 0, stars: 5.0
Views: 75, today: 0, week: 9, month: 17

by alp-shah posted Oct 5, 8:28

Thanks for your answer.

I got your point. My still worry is how do I make sure that new response doesn't impact my old response. I am looking for a way to do regression test. So if my question "what is life insurance" was answering to User question "what is life insurance" & "what is life insurance policy". When I add new question "what is insurance policy?", I should able to validate that it doesn't alter answer for  "what is life insurance policy" but only "what is insurance policy".  I understand that i need to go back and update previous question by adding keywords "life" but I am trying to find some automated solution like we have with JUnit where we can validate any regression in code after change.

May be my question is not relevant for bot and you can't answer it, I am happy with your explanation.

Thumbs up: 0, thumbs down: 1, stars: 2.0
Views: 253, today: 1, week: 30, month: 65

by admin posted Oct 5, 10:38

As with any regression testing, changes to code and functionality can affect previous results. That is the entire point of regression testing. If changes never affected existing results, then there would be no point to regression testing.

New responses will affect existing "non exact" responses if they are better matches than the existing response. By doing regression testing you will be able to review existing questions that are affected, and if they new responses are not correct then fix them accordingly (by adding the questions to the intent label, or by configuring keywords correctly).

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 156, today: 0, week: 20, month: 37

Идентификатор: 460438
Теги: keywords, training, chat logs, responses
Опубликовано: Oct 9 2014, 6:51
Обновлено: Oct 2, 8:04
Ответы: 8
Вид: 2170, сегодня: 1, неделю: 38, месяц: 73
Я уверен, что
Вывесить флаг как оскорбительное, или в нарушение правил сайта