Intent

intent 将开放式用户输入映射到结构化对象。系统会利用 Google 的自然语言理解 (NLU) 技术将语音短语与意图进行匹配。意图匹配可以在对话设计中触发事件,以推进用户的对话。intent 名称在文件名称中指定。

YAML 表示法
parameters: 
  - object (IntentParameter)
trainingPhrases: 
  - string
字段
parameters[]

object (IntentParameter)

训练短语中的参数列表。所有参数都必须在此处进行定义,以便在训练短语中使用。

trainingPhrases[]

string

借助训练短语,Google 的 NLU 可以将意图与用户输入内容自动匹配。提供的唯一短语越多,匹配此意图的可能性就越大。以下是带注解的训练短语部分的格式。请注意,auto 字段是可选字段,未指定 auto 时的默认行为等同于 auto=false($<paramName> '<sample text>' auto=<true or false>) auto = true 表示相应部分已由 NLU 自动注释。auto = false 表示该部分已被用户添加注释。在未指定 auto 时,此项为默认值。例如:“预订从 ($source 'San Francisco' auto=false)飞往 ($dest 'Vancouver')”的航班

IntentParameter

可在训练短语中使用的参数的定义。

YAML 表示法
name: string

# Union field parameter_type can be only one of the following:
type: 
  object (ClassReference)
entitySetReferences: 
  object (EntitySetReferences)
# End of list of possible types for union field parameter_type.
字段
name

string

必需。intent 参数的唯一名称。可在条件和响应中使用,以引用由 NLU 使用 $intent.params.[name].resolved 提取的 intent 参数

联合字段 parameter_type。intent 参数的类型。parameter_type 只能是下列其中一项:
type

object (ClassReference)

可选。声明此参数的数据类型。不应为内置 intent 设置此字段。

entitySetReferences

object (EntitySetReferences)

可选。对此 intent 参数允许的实体集的引用。仅对内置 intent 的参数有效。这些引用指向“custom/entitySets”目录中的 entity 集。

EntitySetReferences

intent 参数的实体集引用。

YAML 表示法
entitySetReferences: 
  - object (EntitySetReference)
字段
entitySetReferences[]

object (EntitySetReference)

必需。intent 参数的实体集引用。

EntitySetReference

对此 intent 参数允许的实体集的引用。

YAML 表示法
entitySet: string
字段
entitySet

string

必需。用于标识给定参数要考虑的特定实体集合。相应的实体集定义应包含在 custom/entitySets/ 目录中。