后备操作未触发

时间:2019-02-25 06:26:10

标签: nlp rasa-nlu rasa-core

Rasa无法检测到垃圾短语(“ afdas afadfasdf”),也无法触发fall_back_action。任何帮助将不胜感激。谢谢

training.md

## intent:say_thanks

- Thanks you so much
- helpful it, thanks
- appreciate it, congrats
- appreciate it, helpful
- appreciate it, thanks
- nice, apreciate
- nice, lol
- really, thnx
- thanku
- thank u
- nice, thank you
- nice, thnx
- nice
- Thanks you too !
- Thank you :)

## intent:isnt_happy

- terrible performance
- i am not happy with your performance
- you are so stupid
- you are so bothersome
- you are so silly
- you are so tiresome
- don't test my patience
- dont piss me off
- you are pissing me off
- you are so annoying
- I do not approve of this bot. It's absolutely terrible .
- I am not content about this service of yours
- I am sad

policies.yml

政策:

 - name: KerasPolicy
   epochs: 1000
   max_history: 3
   batch_size: 10
   validation_split: 0.2

 - name: MemoizationPolicy
   max_history: 3
 - name: FallbackPolicy
   nlu_threshold: 0.4
   core_threshold: 0.3
   fallback_action_name: "utter_fallback_action"

domain.yml

intents:
 - say_thanks
 - isnt_happy

templates:

  utter_say_thanks:
  - text: "You're welcome :-)"
  - text: "Just doing my job!"
  - text: "Any time :-)"

  utter_isnt_happy:
  - text: "I am sorry :-("
  - text: "Sorry I didn't mean to make you sad"
  - text: "Sorry, i didn't met your expectations. My creators are working hard to improve me."

  utter_fallback_action:
  - text: "I didn't understood that. My creators are working hard to make me better."

actions:
 - utter_say_thanks
 - utter_isnt_happy
 - utter_fallback_action

stories.md

## talk_say_thanks
* say_thanks
    - utter_say_thanks

## talk_isnt_happy
* isnt_happy
    - utter_isnt_happy

1 个答案:

答案 0 :(得分:0)

由于您只有两个意图,因此与您拥有更多意图相比,可以更有把握地预测它们。通常,这应该不成问题,但是在设置后备置信度阈值时,必须牢记这一点。

但是,为了更容易检测回退,尤其是在缺乏训练数据和意图的情况下,我建议添加第三个意图。例如out_of_scope,其中添加了一些随机的东西,这些东西不应被您的其他任何意图所吸收:

## intent:out_of_scope

- fggsf dnek ofjkfn
- I am hungry
- where are we going
- tell me a joke
- i want to book a restaurant
- jfhr qsaasr fvndveti 

现在,您可以添加一个故事以通过后备方式处理此意图。

* out_of_scope
   - utter_fallback_action