如何在 Dialogflow 中设置复杂的 'IsList' 参数
How to setup a complicated 'IsList' parameter in Dialogflow
我正在看这个link:
Actions and parameters | Dialogflow Documentation | Google Cloud
在解释 'List parameters' 的地方使用了这些示例:
- "I want apples"
- "I want apples and oranges"
- "I want apples, oranges, and bananas"
然后我想知道是否可以设置一个 'List parameter' 来处理这样的事情:
"I want 7 apples, 8 oranges and 12 bananas"
所以你会有一种键值对列表。
伪代码:
List<KeyValuePair<string, int>> fruitList = new List<KeyValuePair<string, int>>();
KeyValuePair<string, int> applesItem = new KeyValuePair<string, int>("apples", 7);
KeyValuePair<string, int> orangesItem = new KeyValuePair<string, int>("oranges", 8);
KeyValuePair<string, int> bananasItem = new KeyValuePair<string, int>("bananas", 12);
fruitList.Add(applesItem);
fruitList.Add(orangesItem);
fruitList.Add(bananasItem);
因此,在 dialogflow 中,$FruitList
参数类似于上面的键值对列表 fruitList
。
数字部分应与 @sys.cardinal
实体相匹配。水果部分应该与一个自定义实体 @Fruits
相匹配,里面有一堆水果。
伪代码:List<KeyValuePair<@sys.cardinal, @Fruits>>
如何在 Dialogflow 中创建一个可以执行此操作的 'Intent'?
可能吗?
感谢帮助/建议。
我不确定您是否可以获得 dialogflow return 键值对对象,但是使用复合实体您可以创建一个由数量(数字)和水果(水果实体)组成的实体。您可以调用此复合实体订单,并在您的意图中将其作为参数列表。当您输入
"I want 7 apples, 8 oranges and 12 bananas"
您应该得到一个包含 3 个订单实体(7 个苹果、8 个橙子、12 个香蕉)的列表
https://cloud.google.com/dialogflow/docs/entities-developer#developer_composite
我正在看这个link:
Actions and parameters | Dialogflow Documentation | Google Cloud
在解释 'List parameters' 的地方使用了这些示例:
- "I want apples"
- "I want apples and oranges"
- "I want apples, oranges, and bananas"
然后我想知道是否可以设置一个 'List parameter' 来处理这样的事情:
"I want 7 apples, 8 oranges and 12 bananas"
所以你会有一种键值对列表。
伪代码:
List<KeyValuePair<string, int>> fruitList = new List<KeyValuePair<string, int>>();
KeyValuePair<string, int> applesItem = new KeyValuePair<string, int>("apples", 7);
KeyValuePair<string, int> orangesItem = new KeyValuePair<string, int>("oranges", 8);
KeyValuePair<string, int> bananasItem = new KeyValuePair<string, int>("bananas", 12);
fruitList.Add(applesItem);
fruitList.Add(orangesItem);
fruitList.Add(bananasItem);
因此,在 dialogflow 中,$FruitList
参数类似于上面的键值对列表 fruitList
。
数字部分应与 @sys.cardinal
实体相匹配。水果部分应该与一个自定义实体 @Fruits
相匹配,里面有一堆水果。
伪代码:List<KeyValuePair<@sys.cardinal, @Fruits>>
如何在 Dialogflow 中创建一个可以执行此操作的 'Intent'? 可能吗?
感谢帮助/建议。
我不确定您是否可以获得 dialogflow return 键值对对象,但是使用复合实体您可以创建一个由数量(数字)和水果(水果实体)组成的实体。您可以调用此复合实体订单,并在您的意图中将其作为参数列表。当您输入
"I want 7 apples, 8 oranges and 12 bananas"
您应该得到一个包含 3 个订单实体(7 个苹果、8 个橙子、12 个香蕉)的列表
https://cloud.google.com/dialogflow/docs/entities-developer#developer_composite