rasa_nlu如何使用lookup_tables进行实体提取? [英] How rasa_nlu using lookup_tables for entity extraction?

查看:1237
本文介绍了rasa_nlu如何使用lookup_tables进行实体提取?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用rasa nlu和rasa core开发一个聊天机器人.但是我没有得到如何使用lookup_tables进行实体提取的rasa_nlu链接.我已经经历过( http://blog.rasa.com/improving-entity-extraction/)链接,但无法获取. lookup_table应该如何用于提取实体?

I am trying to develop a chatbot using rasa nlu and rasa core. But I am not getting the link how rasa_nlu using lookup_tables for entity extraction. I had already go through (http://blog.rasa.com/improving-entity-extraction/) link but not getting it. How should lookup_table used for to extract the entity?

推荐答案

要求:

如果要使用查找表,请确保:

If you want to use lookup tables, make sure:

  • 您拥有 intent_entity_featurizer_regex ner_crf /nlu/choosing_pipeline/"rel =" nofollow noreferrer> NLU管道
  • 您要匹配的实体范围明确且范围狭窄
      诸如食物名称,公司名称,汽车品牌之类的实体不太可能出现在您不希望与之匹配的环境中.因此,查找表对他们来说是一个很好的用例. 诸如物体之类的实体(例如汽车",房屋",纸张")出现在您根本不希望与之匹配的各种环境中.因此,使用查找表甚至可能导致更糟的结果.
    • you have the components intent_entity_featurizer_regex and ner_crf in your NLU pipeline
    • the entities you want to match fit have a well defined and narrow scope
      • entities like food names, company names, car brands are unlikely to appear in contexts you in which you don't want to match them. Hence, look up tables are a good use case for them.
      • entities like objects (e.g. "car", "house", "paper") appear in a variety of contexts in which you don't want to match them at all. Therefore, using look up tables might even lead to worse results.

      在您的训练数据中

      要使用查找表,您可以直接在训练数据中定义它们,例如:

      In order to use look up tables, you can either define them directly in the training data, e.g.:

      ## intent:check_balance
      - what is my balance <!-- no entity -->
      - Could I pay in [yen](currency)?  <!-- entity matched by lookup table -->
      
      ## lookup:currency   <!-- lookup table list -->
      - Yen
      - USD
      - Euro
      

      或者您可以将它们写在文本文件中:

      Or you can write them in a text file:

      Yen
      USD
      Euro
      

      然后在训练数据中包含文本文件的路径:

      And then include the path to the text file in your training data:

      ## intent:check_balance
         ... like before
      
      ## lookup:food
          <path to your look up table text file>.txt
      

      接受我可以用欧元付款吗?之类的输入,然后Rasa NLU将插槽currency的值设置为Euro.

      Taking an input like Could I pay in Euro?, Rasa NLU then sets the value of the slot currency to Euro.

      它们如何工作

      查找表中的单个项目将添加到正则表达式(regex),该正则表达式将应用于用户发送到bot的消息.但是,如果您的用户输入错字(例如,查找表条目PesosPeesos不匹配.要同时匹配这些情况,您可以尝试模糊匹配,这在您链接的博客文章中有介绍.确保您的查询表不会太大,因为Rasa NLU必须检查每个句子是否与您的查询表项之一匹配.

      The single items in a look up table are added to a regular expression (regex) which is applied to the the messages which your users send to the bot. However, look up tables don't work if your user inserts typos, e.g. a look up table entry Pesos would not match Peesos. To also match these cases you can try fuzzy matching which is described in the blog article you linked. Make sure that your look up tables don't become too large as Rasa NLU has to check every sentence whether it matches one of your look up table entries.

      也许 Rasa NLU文档也可以为您提供帮助.

      Maybe the Rasa NLU documentation can also help you.

      这篇关于rasa_nlu如何使用lookup_tables进行实体提取?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆