加入机器人自由开放源码项目 BotLibre.org
文档 : 用户手册 : Response List

响应列表

概述

一个响应列表是机器人自由的文本格式的文件,用于确定一个机器人的响应。 一个响应列表中列出的问题/响应对。 每个短语是分离的新行,每个问题/响应的列表中被分离的空行。 你还可以标记的答复与的元数据,如关键词来影响时应使用。 响应列出了被推荐的方法训练的机器人。 机器将会自动找到最好的匹配的反应对于任何问题,该问题不需要确切匹配,只有充分类似的,或包括一个关键词。

响应的标签

标记 描述
问题: 定义问题。 这不是必需的,作为第一线后一个空白线的假设为一个新的问题。
模式: 定义问题作为一个模式。 模式,允许配符*和其他野卡的使用。
答复: 定义的响应。 这不是必需的,因为任何线后的问题,因为假定的反应。
模板: 定义响应的模板。 这可以让你嵌入自内的代码{}括号内的动态的反应。
情绪: 你可以联系的情绪(良好的/不良)与短语。
条件: 你也可以选择给一个条件在自我的代码,必须为真正的响应可使用。
认为: 你也可以选择给一个"认为"的代码自我评估响应时使用。
命令: 你也可以选择给一个语言在命(自身的代码),进行评估和向客户返回,以支持的游戏和虚拟的援助。
主题: 你也可以选择给一个主题分类的响应。
需要主题: 如果主题是必需的,应将只能用于该主题的活动。
专题: 如果主题是排他性的,唯一的回应,分享主题将被使用的话,题目是积极的。
标签: 你也可以选择给一个标签,以重复使用的响应。
关键词: 你也可以选择给予的关键字的问题,会影响响应相匹配。
要求: 你也可以选择给需要的话自问题,将需要用于回应相匹配。
情绪: 你可以将一种情感的反应。
行动: 你可以联系的行动与反应。
姿势: 你可以将一个姿势与反应。
重复: 你也可以选择给予的响应来使用,如果当前的响应已经使用这一对话。
没有重复: 需要的响应或短语只能使用一次。
以前: 你也可以选择给一个先前的响应得到响应上下文。
需要以前: 要求的回应只能使用,如果以前的回应相匹配的一个前反应。
信心: 信任可以使用,如果一个响应是不定的。 匹配的反应以最高的信心将使用。

question:

响应的问题可能是一个短语,将自动匹配,与类似的问题,或者可以一个模式。 模式匹配的从字面上的秩序的词语的模式,可以通配符例如*也可以包括定期的表达。 通常,最好是使用一个短语,并让机器人决定,如果一个问题,应该比赛,你也可以增加关键词和需要的话,以改善当一个问题是匹配的。 输入模式的使用模式:标签。

what is your name
question: what is your name
pattern: What is *

response:

响应可以是一个短语,可以包含HTML或丰富的内容,包括图像、视频和按钮,或者反应可以是一个模板。 一模板是一个反应,可以包括一些自我的代码。 任何代码{}在一个模板,将执行和结果的印刷成本反应。 输入模板的使用的模板:标记和进入自内的代码{}括号内。

My name is Julie.
My name is <b≷Julie</b≷.
response: My name is Julie.
template: My name is {#self.name}.
template: The date is {Date.date()}.

keywords:

Keywords are important words in the question that should influence when the response is used.

// Keywords are used to allow this response to be used for any questions on hockey or spinach.
question: do you like hockey
response: Hockey is my favorite sport.
keywords: hockey

question: what do you love
response: I love hockey!
keywords: love luv like adore

question: do you like field hockey
response: I only play ice hockey.
keywords: "field 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. In the example, the bot knows two responses, how will it respond to the phrase "I love hockey"? Without the keywords 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 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.

If you keywords has many similar words. You can list them all as keywords to match any of the words. You could also define these words a synonyms, which may be a better option.

You can also use compound words are keywords. A compound keyword must have all the words in the order to be used. For a compound keyword just wrap the words in "quotes".

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 also review all of your bot's keywords by searching for 'words' and restrict to 'keywords'. This lets you remove a word from being a keyword if you added it by mistake.

required:

A required word is a word that is required to be in the question for a specific response.

// This example requires the words 'like' and 'hockey'.
question: do you like hockey
response: Yes, I like hockey.
required: like hockey

// This example requires the compound word 'ice hockey'.
question: do you like ice hockey
response: Yes, I like ice hockey.
required: "ice hockey"

// This example requires one of the words 'like' or 'love', and 'hockey'.
question: do you like ice hockey
response: Yes, I like ice hockey.
required: (like love) hockey

// This example requires a pattern.
question: are you okay
response: Yes, I am okay.
required: Pattern("^ are you (ok okay)")

A required word can be used to ensure the bot does not choose a response if the required word is missing from the question. For example the question "Do you play hockey?" would normally be matched to this response, but because it is missing the required word "like", it will not be considered as a match.

All of the required words must be contained in the question in order for the response to be used. Required words also supports lists, compound words, and patterns. To require one of a set of words a list can be used using brackets i.e. (like love). To require a compound word quotes are used i.e. "hello world". To require a pattern enter the pattern i.e. Pattern("what is *").

Previous

A previous responses is the bot's preceding response. Previous responses can be used to give a response a context.

// This example uses previous to give different answers to 'yes' depending on the context.
question: yes
response: Great, wanna go out sometime?
require previous: Are you single?

question: yes
response: I am please to hear that.
require previous: Are you happy?

The question "Yes" has multiple responses. The bot can use the previous response to choose the best response. You can also invalidate a previous response to ensure the bot does not use a response if the previous response was preceding.

A previous response can either be 'required' or optional. If required, the response will never be used unless one of the previous response matches. If optional (default) the response is given precedence if the previous response matches, but can still be used if the previous does not match.

topic:

A topic is the general topic category for the response. For example a response on a hockey related question would belong to the "hockey" topic. You can use topics to categories your responses and give the bot additional context. If the bot has multiple responses to a question, it will use the one that matches the current topic.

Topics can be either optional or required. The response topic is optional by default, it you click on 'Require Topic', then the response will only be used if that topic is active in the conversation. If optional the topic will be set as active for the conversation, until a new topic is set.

Topics can also be defined as exclusive. An exclusive topic defines an isolated conversational space. For a normal topic that is not exclusive the bot can still use responses that do not have the same topic, but responses with the active topic will be given precedence over responses without a topic. For exclusive topics only response that have the same topic as the active topic will be used. No other responses will be used (other than possibly the default response if there is no topic default).

Topics can also be set on greetings to start the conversation with a topic. Topics can be set on default responses to provide a different response when that topic is active.

// Categorizes the product response.
question: what are your products
response: Our products include ACME CRM and ACME ERP.
topic: products

// Use an exclusive topic to define a joke conversational dialog.
question: joke
response: Knock knock.
exclusive topic: joke

question who is there
response: Boo.
require topic: joke

question: boo who
response: Don't cry. lol
require topic: joke
think: conversation.topic = null;

default: Say 'Who is there?'
require topic: joke

default: Say 'Boo who?'
require topic: joke
previous: boo

label:

A response can be given an intent label to let you reuse the same response in other questions. You can also use labels in a response's previous.

// Use a label to reuse the common products response.
question: products
response: Our products include ACME CRM and ACME ERP.
label: #products

question: what are your products
response: #products

question: what software do you sell
response: #products

question: are they good
response: Our products are the best in the world.
previous: #products

on repeat:

If the user asks the same question, or similar questions multiple times, you may want your bot to give a different response the second time. On repeat lets you set one or many responses to use the second time that response is triggered in the same conversation. You can also set 'No Repeat' to never repeat the response in the same conversation.

// Offer to escalate the issue if the user repeatedly asks for help.
question: help
response: How can I help you?
on repeat: What is the issue that you are having?
on repeat: Would you like me to have a support staff contact you?

question: goodbye
response: Before you go, would you like to take a survey?
no repeat:

question: goodbye
response: Goodbye.

condition:

Conditions let you enter Self code that must evaluate to true for the response to be used. This is an advanced properties as it requires you understand Self (a dialect of JavaScript), but can be used to do very powerful things.

// Response to goodbye differently based on the time of day.
question: goodbye
response: Goodnight.
condition: Date.get(#hour, Date.time()) > 18

question: goodbye
response: Goodbye.

think:

Think let you enter Self code that is executed when the response is used. This is an advanced properties as it requires you understand Self (a dialect of JavaScript), but can be used to do very powerful things.

// Track the user's name.
pattern: my name is *
template: Pleased to meet you {star}.
think: speaker.name = star;

question: what is my name
template: Your name is {speaker.name}.

question: can we change the subject
response: Sure, what would you like to talk about?
think: conversation.topic = null;

confidence:

You can enter multiple responses for the same question. The bot will use the response that it is the most confident in for the current conversational context. By default a response is given a confidence level of 90%, but you can customize the value. Note that in a group discussion such as when the bot is added to a chatroom, or on Twitter, the bot will only use responses that have >=90% confidence.

sentiment:

You can associate a user question or phrase, or individual words with sentiment (good vs bad). Sentiment can be used to track how the user is feeling about the current conversation. The sentiment statistic is tracked by your bot daily and can be graphed from its Analytics page.

question: thank you
response: You are most welcome.
keywords: thank
sentiment: good

question: you suck
response: Sorry, I am doing my best. Would you like me have someone contact you via email?
keywords: suck
sentiment: bad

word: suck
sentiment: bad

word: great
sentiment: great

接下来和谈话的流

下一个问题,在响应可用于处理后续问题和谈话的流动。 开始交谈的流动,缩进的下一步后续行动问题的响应。 你可以使用的标签或4的空间缩进。 你也可以缩进多层次的定义对话的树。

一respones下一个问题,定义了一个孤立的对话空间。 机器人只会选择其下一次响应,从所提供的答复。 定义默认应使用默认的标记。 如果机器人不匹配的用户问题的下一个问题,它将搜索的响应父母,否则使用机器人的默认响应。

下一步类似于以前的,但与往年不同的是孤立的响应。 在下一个的下一个回应,机器人永远不会使用其任何答复之外的下一次反应。 这使得易于定义的孤立和嵌套的对话。

question: help
response: Do you want help with <button>web</button> or <button>mobile</button>
keywords: help

	question: web
	response: Is you issue with <button>HTML</button> or <button>JavaScript</button>?

		question: html
		response: See https://www.w3schools.com/html

		question: javascript
		response: See https://www.w3schools.com/js

	question: mobile
	response: Are you using <button>Android</button> or <button>iOS</button>?

		question: android
		response: See https://www.android.com

		question: ios
		response: See https://developer.apple.com/ios

	question: quit
	response: Okay. Let me know if you need further help.

	default: Please specify <button>web</button> or <button>mobile</button>, or type <button>quit</button> if you do not need help.

问候

问候是机器人的第一反应在一个新的对话。 问候可以拥有相同的大多数标签作为答复。 定义问候贺:标签是使用。

greeting: Welcome to my website. I am Julie, how may I be of service?

默认的答复

如果机器人找不到任何好的匹配的问题给用户的投入,它使用其默认的响应。 默认的反应可以大多数同样的标签,作为答复。 定义一个默认的响应中的缺省标签是使用。

default: Sorry, I do not understand.
			
default: Sorry, I do not understand. Please email [email protected] for more information.
topic: Sales

短语

短语可定义的关联感情、情绪、行动或构成一个短语。

thanks for the help
sentiment: good

you are not helping me
sentiment: bad

词语可以界定相关联感情、情绪和同义词。 一个单词也可以是一个关键词、题目或专题。

word: good
sentiment: good
synonyms: great wonderful cool amazing 

word: bad
sentiment: bad
synonyms: sucks terrible horrible

word: aiml
keyword: true
topic: true

字的标签

标记 描述
字: 定义一词。
情绪: 你也可以选择相关联的一种情绪的词语。
情绪: 你也可以选择相关联的情感的话。
关键字: 定义一词是一个关键词。
同义词: 你也可以选择给一个同义词,这样,类似的话中的一个问题,触发了同样的响应。
主题: 定义一词是一个主题。
专题: 定义一词是一个专属的主题。

也参看