如果在Rasa中无法识别意图该怎么办?

时间:2018-05-22 10:42:41

标签: python nlp

我按照Justina Petraityte提供的weather rasa chatbot,你可以找到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

1 个答案:

答案 0 :(得分:1)

每个意图必须至少有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后端。

遵循这本烹饪书,使用RASA NLU使用python构建本地聊天机器人: Step by step (cookbook) to build your chatbot