微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Rasa Chatbot 无法响应用户输入

如何解决Rasa Chatbot 无法响应用户输入

我使用 DIETClassifier 进行实体提取,这是我的管道:

pipeline:
  - name: SpacyNLP
    model: en_core_web_sm
  - name: SpacyTokenizer
  - name: CountVectorsFeaturizer
  - name: CRFEntityExtractor
  - name: DIETClassifier
    epochs: 200
    random_seed: 2

这是我对 nlu 文件中的实体的意图示例:

version: "2.0"

nlu:
- intent: flight_search_intent
  examples: |
    - I want to [travel](Search_flight)
    - I want a travel [ticket](Search_flight)
    - I want a [flight](Search_flight) ticket
    - find a [flight](Search_flight) for me please
    - find a [flight](Search_flight) for me,please
    - Can you please find a [flight](Search_flight) ticket for me?
    - I want to book a [flight](Search_flight) ticket
    - I want to book a [ticket](Search_flight)
    - Can you please find a [flight](Search_flight) for me?
    - I want to book a [flight](Search_flight) asap
    - I want to book a [flight](Search_flight)
    - I am looking for a [flight](Search_flight)
    - find a [flight](Search_flight) for me
    - I wanna to [travel](Search_flight)
    - I need a [trip](Search_flight)

# 2) flight_search_intent_with_daeparture_and_destenation_cities_and_departure_date:
- intent: flight_search_intent_with_daeparture_and_destenation_cities_and_departure_date
  examples: |
    - I am looking for a [flight](Search_flight) from [Arrabury]{"entity": "city","role": "departure"} to [Annaba]{"entity": "city","role": "destination"} [Tomorrow](departure_date).
    - I want to book a [flight](Search_flight) from [dammam]{"entity": "city","role": "departure"} to [Jeddah]{"entity": "city","role": "destination"} on [14/05/2022](departure_date).
    - I want to book a [flight](Search_flight) from [Berlin]{"entity": "city","role": "departure"} to [San Francisco]{"entity": "city","role": "destination"} on [30/1/2021](departure_date).
    - Can you please find a [flight](Search_flight) for me from [Al Madinah]{"entity": "city","role": "departure"} to [Abha]{"entity": "city","role": "destination"} on [3-4-2020](departure_date).
    - Book a [flight](Search_flight) from [Al Kharj]{"entity": "city","role": "departure"} to [Bonthe]{"entity": "city","role": "destination"} [Today](departure_date).
    - Book a [flight](Search_flight) from [Colombo]{"entity": "city","role": "departure"} to [Paris]{"entity": "city","role": "destination"} on [January,21st,2020](departure_date).
    - find a [flight](Search_flight) for me from [Berlin]{"entity": "city",2020](departure_date).
    - I want to [fly](Search_flight) from [Berlin]{"entity": "city","role": "destination"} on [17th January 2021](departure_date).
    - I wanna [trp](Search_flight) from [Berlin]{"entity": "city","role": "destination"} on [17th January 2021](departure_date).
    - I need a [flight](Search_flight) from [Berlin]{"entity": "city","role": "destination"} [Tomorrow](departure_date).

这是我的故事的例子:

#1) Flight serch function stories:
- story: flight_search_function_story_1
  steps:
  - intent: greet
  - action: utter_greet
  - intent: flight_search_intent
  - action: utter_ask_about_trip_kind
  - intent: provide_round_trip
  - action: utter_ask_about_departure_city
  - intent: provide_departure_city
  - action: utter_ask_about_departure_date
  - intent: provide_date
  - action: utter_ask_about_destination_city
  - intent: provide_destination_city
  - action: utter_ask_about_return_date
  - intent: provide_date
  - action: utter_suitable choices
  - action: utter_something_else
  - intent: thanking
  - action: utter_welcome_thanks
  - intent: goodbye
  - action: utter_goodbye

这是我的域文件的一部分,我在其中列出了所有意图、实体和响应:

version: "2.0"

intents:
  - afternoon
  - morning
  - provide_date
  - nice_to_meet
  - provide_destination_city
  - get_Kind_of_cities
  - waiting
  - get_weather
  - greet
  - goodbye
  - goodnight
  - welcome_thanks
  - provide_one_way_trip
  - nice_to_talk
  - askingAboutDoingWithName
  - askingAboutDoingWithOutName
  - flight_search_intent_with_daeparture_and_destenation_cities_only
  - flight_search_with_destenation_only
  - flight_search_intent
  - provide_email
  - flight_search_intent_with_daeparture_and_destenation_cities_and_departure_date
  - provide_departure_city
  - evening
  - see_again
  - bot_challenge
  - provide_issue_deatils
  - user_waiting
  - well_done
  - sorry
  - get_Hoppies
  - thanking
  - flight_search_with_departure_only
  - provide_round_trip
  - provide_name
  - provide_phone_number
  - Connect_agent
  - place_to_visit

entities:
  - return_date
  - phone
  - provide_name
  - get_issue_details
  - weather_type
  - round_flight
  - report_issue
  - one_way_flight
  - hobby
  - return_decision
  - city_type
  - Search_flight
  - email
  - departure_date
  - name
  - city:
      roles:
        - departure
        - destination


responses:
  utter_greet:
  - text: "Hi I am Tickie! How can I help you?"

  utter_cheer_up:
  - text: "Here is something to cheer you up:"
    image: "https://i.imgur.com/nGF1K8f.jpg"

  utter_did_that_help:
  - text: "Did that help you?"

但是,当我使用 rasa train 命令训练我的聊天机器人并使用 rasa shell 命令对其进行测试时,它仅对用户(我)的第一个输入做出响应,然后响应停止在职的!我找了 2 个星期的错误解决方案,但我没有找到,这是一个例子:

enter image description here

有人可以帮我吗?或者如果我上面提到的文件中有任何错误,有人可以告诉我错误是什么吗?我遵循了域文件的 rasa 文档以及如何在意图中定义实体,但我遇到了这个问题,而且我在互联网上找到的所有解释都不是 rasa 2.0,所以我不知道是什么问题

但是,当我从域文件删除实体时,它有响应!但它是这样的:

enter image description here

它说将实体添加到域文件中,正如我之前向您展示的那样,当我添加它们时,响应停止工作

解决方法

除非域文件没有显示您实际域文件中的所有响应,否则您的问题是您没有为故事中的大多数响应提供响应文本。您可能在添加实体时不小心删除了这些。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。