1

我使用 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", "role": "departure"} to [San Francisco]{"entity": "city", "role": "destination"} on [January,21st,2020](departure_date).
    - I want to [fly](Search_flight) from [Berlin]{"entity": "city", "role": "departure"} to [San Francisco]{"entity": "city", "role": "destination"} on [17th January 2021](departure_date).
    - I wanna [trp](Search_flight) from [Berlin]{"entity": "city", "role": "departure"} to [San Francisco]{"entity": "city", "role": "destination"} on [17th January 2021](departure_date).
    - I need a [flight](Search_flight) from [Berlin]{"entity": "city", "role": "departure"} to [San Francisco]{"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 周,但我没有找到,这是一个例子:

在此处输入图像描述

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

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

在此处输入图像描述

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

4

1 回答 1

1

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

于 2021-02-08T07:33:47.463 回答