首页 > 解决方案 > 如果在 Rasa 中无法识别意图怎么办?

问题描述

我关注了Justina Petraityte提供的天气 rasa 聊天机器人,你可以在这里找到 GitHub 存储库。然而,我的聊天机器人永远无法识别我试图向他提供的意图,它必须是位置,而且我不知道如何处理这种情况,因为它在调用天气 API 时会产生错误,因此它是空的。

例如,我试图询问意大利的天气,但是你可以在这里看到。它不承认意大利是一个意图,即使它在data.json.

例如 :

我们可以看到他无法识别意图的示例的图像

因此,当意图未被识别时该怎么办?我们还应该把它保存到 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)

蟒蛇版本

(MoodbotEnv) mike@mike-thinks:~/Programing/Rasa_tutorial/moodbot4$ python -V 
Python 3.5.2

操作系统

Linux 16.04

标签: pythonnlp

解决方案


对于每个意图,您必须至少有 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"

这是一个如何构建以前版本的指南,在完成 tut 之后,您所要做的就是更改配置文件以切换到 TF 后端。

按照这本烹饪书,使用 RASA NLU 使用 python 构建本地聊天机器人: 逐步(食谱)构建您的聊天机器人


推荐阅读