我关注了 Justina Petraityte 提供的天气 rasa 聊天机器人,您可以找到 GitHub 存储库 here .然而,我的聊天机器人从未识别出我试图向他提供的意图,这必须是位置,而且我不知道如何处理这种情况,因为它在调用天气 API 时会产生错误,因此它是空的。
例如,我试图询问意大利的天气,但是,如您所见here .它不会将意大利识别为意图,即使它在 data.json
中也是如此。
例如:
Image where we can see an example where he doesn't recognizes the intent
因此,当意图未被识别时该怎么办?我们还应该将它保存到 stories.md 吗?
域文件内容:
action_factory: null
action_names:
- utter_greet
- utter_goodbye
- utter_ask_location
- action_weather
actions:
- utter_greet
- utter_goodbye
- utter_ask_location
- actions.ActionWeather
config:
store_entities_as_slots: true
entities:
- location
intents:
- greet
- goodbye
- inform
slots:
location:
initial_value: null
type: rasa_core.slots.TextSlot
templates:
utter_ask_location:
- text: In what location?
utter_goodbye:
- text: Talk to you later.
- text: Bye bye :(
utter_greet:
- text: Hello! How can I help?
topics: []
Rasa 核心版本:
(MoodbotEnv) mike@mike-thinks:~/Programing/Rasa_tutorial/moodbot4$ pip list :
...
rasa-core (0.9.0a3)
rasa-nlu (0.12.3)
Python 版本:
(MoodbotEnv) mike@mike-thinks:~/Programing/Rasa_tutorial/moodbot4$ python -V
Python 3.5.2
操作系统:
Linux 16.04
最佳答案
每个意图必须至少有 2-10 个示例 您拥有的训练示例越多越好。
我建议使用 Tensorflow、Spacy、CRF 后端组合,并为每个意图使用 5-10 个示例,对我来说效果非常好! 将其用作您的 config.yml
pipeline:
- name: "intent_featurizer_count_vectors"
- name: "intent_classifier_tensorflow_embedding"
batch_size: 64
epochs: 1500
- name: "nlp_spacy"
- name: "tokenizer_spacy"
- name: "ner_crf"
这里是一个指南如何构建以前的版本所有你需要做的,完成之后,就是更改配置文件以切换到 TF 后端。
按照这本 cooking 书使用 RASA NLU 使用 Python 构建一个本地聊天机器人: Step by step (cookbook) to build your chatbot
关于python - 如果 Rasa 无法识别意图怎么办?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50465699/