【发布时间】:2026-01-03 07:20:06
【问题描述】:
这是我使用 python 客户端从我的 wit.ai 应用程序获得的响应。 我要做的就是提取:
- 意图值字段。
- 实体类型。
- 实体的值字段。
{'msg_id': '0KqBWZaeY9qKeVvdv3n', '_text': 'what is the temperature', 'entities': {'on_off': [{'confidence': 0.98730879525862, 'value': 'on'}], 'intent': [{'confidence': 0.99846661176623, 'value': 'get_temperature'}]}}
请注意,消息每次都可能不同。在字典中硬编码位置可能不是一个好主意。
{'msg_id': '0GN7pJRwYincs2p7xCo', '_text': 'turn light 1 off', 'entities': {'number': [{'confidence': 1, 'value': 1, 'type': 'value'}], 'on_off' [{'confidence': 0.96433768880251, 'value': 'off'}], 'intent': [{'confidence': 0.99552821331643, 'value': 'lights'}]}}
【问题讨论】: