【问题标题】:Asking user to fill slots in Rasa Chatbot要求用户填写 Rasa Chatbot 中的空位
【发布时间】:2019-02-26 13:41:05
【问题描述】:

当我需要让用户填补空缺时,我正在努力创建一个对话结构。

考虑以下交互。

User: What is the scientific name of Eagles?
Bot: There are 3 eagles. Choose one.

 - greater spotted eagle
 - tawny eagle
 - indian spotted eagle

User: tawny eagle
Bot: Scientific name of Tawny Eagle is Clanga clanga

如果只有一个值,这是我的 Stories.md 文件。

## Story1
* Scientific_name{'common_name': 'eagles'}
  - action_sci_name

还有我的action.py

class ActionSciName(Action):
    def name(self):
        return "action_sci_name"

    def run(self, dispatcher, tracker, domain):
         # below line gives 'Eagles`
         name = tracker.latest_message['entities'][0]['value']
         ## I fetch the value from DB for eagles if they are more than 1
         ## More code here
         response = """There are 3 eagles. Choose one 
                       1. greater spotted eagle
                       2. tawny eagle
                       3. indian spotted eagle"""

         dispatcher.utter_message(response)
         return []

上述文件的第一部分很好。但我被困在下一个用户需要输入这 3 个之间的值的地方。

意图:

  • 科学名称
  • Common_name

实体:

  • common_name
  • sci_name

我看过很多文章和博客,但它们都非常基础。他们使用slots,但用户在第一行输入值。

感谢任何帮助。

【问题讨论】:

  • 我发现您遇到了来自用户的单个单词/短语回复的问题。请在此处参考我的回答。 stackoverflow.com/a/55016421/8169091 告诉我它是如何工作的。
  • 这很有帮助...将字符串/标签附加到用户输入中。

标签: python chatbot rasa-nlu rasa-core rasa


【解决方案1】:

我认为 Rasa 中的 forms 可以帮助您。使用表单,您可以验证输入并指定用户必须填写哪些插槽。

【讨论】:

    猜你喜欢
    • 2020-11-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-29
    • 2023-03-18
    • 1970-01-01
    • 2021-04-12
    • 2021-01-16
    相关资源
    最近更新 更多