【问题标题】:How to fix Rasa Nlu Confidence giving 0 if there is an underscore in the word?如果单词中有下划线,如何修复 Rasa Nlu Confidence 给 0?
【发布时间】:2019-09-04 07:11:54
【问题描述】:

我正在尝试使用Rasa 构建简单的聊天机器人应用程序,但如果单词中有下划线,我的机器人会给出置信度 0。

下面是我的 config.yml 配置:

language: en  
pipeline: supervised_embeddings  
policies:  
  - name: KerasPolicy  
  #- name: MappingPolicy  
  #- name: MemoizationPolicy  
  #- name: FallbackPolicy  

nlu.md 配置:

## intent:name
- name
- nmae
- nme
- what is my name?

## intent: firstname
- firstName
- FName
- first name

## intent: gender
- gender
- sex
- gnder
- gendr
- sx

## intent: lastname
- lastName
- lname
- surname
- lstnme
- lstname

## intent: username
- userName
- uname
- usrnme
- usernme
- userid

如果我通过firstname,我会得到正确的意图和信心,如果我尝试使用_firstnamefirst_name,我会得到以下结果:

first_name
{
  "intent": {
    "name": null,
    "confidence": 0.0
  },
  "entities": [],
  "intent_ranking": [],
  "text": "first_name"
}

【问题讨论】:

    标签: rasa-nlu rasa-core rasa


    【解决方案1】:

    您的置信度为 0,正是因为您在单词中使用了下划线。 first_name 这个词没有在你的训练数据中使用,所以这个词对你的模型来说是陌生的。这就是为什么它不能预测该词的任何内容。 (默认情况下,它使用whitespace tokenizer,因此单词仅由空格标记。)

    因此,要解决您的问题,请不要在单词中使用下划线,或者您可以编辑空格标记器以按空格和下划线进行标记。

    希望对您有所帮助。

    【讨论】:

    • 感谢您的帮助,我可以通过使用 CountVectorsFeaturizer 和分析器 'char_wb' 来解决这个问题。
    • 也有这种方式,但我不太喜欢使用char_wb 选项。我认为它的效果不是很好,因为我认为它会产生更多的误报。
    猜你喜欢
    • 2017-12-04
    • 1970-01-01
    • 2019-09-24
    • 1970-01-01
    • 2012-01-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多