因此,我在django框架中爲我的聊天bot製作了一個對話框。 「對話框」面板由意圖和實體下拉列表以及對話框textarea組成。下拉列表將取決於我的json格式的訓練數據。與json和python相關的下拉列表
我想要下拉列表,這樣如果我選擇intent,實體下拉列表會自動創建並顯示與選定的intent相關的所有實體。
我試過了,我能夠顯示意圖下拉菜單,但也有重複意圖(我使用python set函數刪除)。但我無法弄清楚如何顯示基於一個特定意圖的所有實體。
幫助我。這是我的例子JSON:
{"rasa_nlu_data": {
"common_examples": [
{
"text": "hey",
"intent": "greet",
"entities": []
},
{
"text": "yep",
"intent": "affirm",
"entities": []
},
{
"text": "i'm looking for a place to eat",
"intent": "restaurant_search",
"entities": []
},
{
"text": "i'm looking for a place in the north of town",
"intent": "restaurant_search",
"entities": [
{
"start": 31,
"end": 36,
"value": "north",
"entity": "location"
}
]
},
{
"text": "show me chinese restaurants",
"intent": "restaurant_search",
"entities": [
{
"start": 8,
"end": 15,
"value": "chinese",
"entity": "cuisine"
}
]
},
{
"text": "bye",
"intent": "goodbye",
"entities": []
}
]}}
我低估了,因爲你的問題格式非常糟糕。缺乏連詞,句子之間沒有空格,缺少段落,並且用小寫字母「i」引用你自己,至少在我看來,你的問題很難閱讀。您發佈的示例代碼太長且冗餘。請解決您的問題 - 如果您希望有人幫助解決您的問題,那麼這是最不可能的。 – xyres
Ok.I在一定程度上改進了格式 –