Watson对话-从嵌套上下文中检索特定数据 [英] Watson Conversation - Retrieving specific data from nested context
本文介绍了Watson对话-从嵌套上下文中检索特定数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望交互看起来像这样:
I'd like the interaction to look like this:
- 批注:命名国家
- 用户:墨西哥
- Bot:墨西哥的人口为 大约120M.
- Bot: Name a country
- User: Mexico
- Bot: The population of Mexico is approximately 120M.
现在,我已经对人群进行了硬编码,如下所示:
For now, I've got the populations hard-coded and looks like below:
{
"context": {
"inputcountry": "<?@Country?>",
"populations": {
"USA": "300M",
"Mexico": "100M",
"Japan": "127M"
}
},
"output": {
"text": {
"append": true,
"values": [
"The population of $inputcountry is approximately $populations.$inputcountry"
]
}
}
}
使用用户输入作为标识符/查找来提供特定人口编号的语法是什么?
What is the syntax to provide the specific population number using the user input as the identifier/lookup?
使用$ populations.上面显示的$ inputcountry返回
Using $populations.$inputcountry shown above returns
{"USA": "300M","Mexico": "100M","Japan": "120M"}.Mexico
推荐答案
尝试<? $populations.get($inputcountry) ?>
-应该可以解决问题.
Try <? $populations.get($inputcountry) ?>
- that should do the trick.
这篇关于Watson对话-从嵌套上下文中检索特定数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文