2

ユーザーにスロットを埋めるように依頼する必要があるときに、対話構造を作成するのに苦労しています。

次の相互作用を考えてみましょう。

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値が 1 つしかない場合のファイルは次のとおりです。

## 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つの間の値を入力する必要がある次の場所で立ち往生しています。

意図:

  • 学名
  • 一般名

エンティティ:

  • 一般名
  • sci_name

多くの記事やブログを見てきましたが、それらは非常に基本的なものです。彼らは使用しますslotsが、ユーザーは最初の行自体に値を入力します。

どんな助けでも大歓迎です。

4

1 に答える 1