简体   繁体   English

如何在wit.ai中从“机器人发送”中提取实体

[英]How to extract entities from 'bot sends' in wit.ai

I have a scenario like this 我有这样的情况

User says: What's the temperature in SF?
bot executes: get_forecast
updates context with: forecast
bot send: {forecast}

Is there a way to use {forecast} and extract entities from it? 有没有办法使用{forecast}并从中提取实体? For example, I can continue the above story as - 例如,我可以将上述故事继续为-

User say: convert that in celsius
<extract temperature from {forecast} set entities>
bot execute: convert_to_celsius
updates context with: temperature
bot sends: {temperature}

Any suggestions on how to do this? 有关如何执行此操作的任何建议?

The entity value can be stored in context, or on your backend/server. 实体值可以存储在上下文中,也可以存储在后端/服务器上。

If you store {forecast} in context, when user request conversion to celsius, you retrieve it from context, convert it and update context with {temperature}. 如果将{forecast}存储在上下文中,则当用户请求转换为摄氏度时,将从上下文中检索它,将其转换并用{temperature}更新上下文。

However, note that 'context' is passed around between user and your backend so I do not recommend putting too many unnecessary values in it, due to more data being transmitted for each call. 但是,请注意,“上下文”在用户和您的后端之间传递,因此,由于每次调用都会传输更多数据,因此我不建议在其中添加过多不必要的值。

For your use case, you could storing {forecast} on your server instead. 对于您的用例,您可以将{forecast}存储在服务器上。 When user request conversion, simply retrieve it and update context. 用户请求转换时,只需检索它并更新上下文。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM