簡體   English   中英

wit.ai HTTP API 話語請求無法驗證話語

[英]wit.ai HTTP API utterance request fails to validate utterance

我正在嘗試使用wit.ai 的話語 HTTP API 端點 我在 wit.ai 界面中設置了一些測試短語並創建了實體。 實體被注冊為與意圖相關。 我已將實體設置為“自由文本”。

現在,我正在嘗試使用 Python 以編程方式批量添加話語/實體。下面是我要發送的話語/實體的示例:

[{
  "text": "I want to get a cat, dog, and bird.",
  "intent": "want_pet",
  "entities": [
    {
      "entity": "pet",
      "start": 16,
      "end": 19,
      "body": "cat",
      "entities": []
    },
    {
      "entity": "pet",
      "start": 21,
      "end": 24,
      "body": "dog",
      "entities": []
    },
    {
      "entity": "pet",
      "start": 30,
      "end": 34,
      "body": "bird",
      "entities": []
    },
  ],
  "traits": []
},
{
  "text": "I'd like a fish and an iguana.",
  "intent": "want_pet",
  "entities": [
    {
      "entity": "pet",
      "start": 11,
      "end": 15,
      "body": "fish",
      "entities": []
    },
    {
      "entity": "pet",
      "start": 23,
      "end": 29,
      "body": "iguana",
      "entities": []
    }
  ],
  "traits": []
}]

但是,當我發送請求時,我收到以下錯誤:

{'error': 'Failed to validate utterance at index 0. Could not find entity "pet".', 'code': 'bad-request'}

關於出了什么問題或我可以調查的任何想法都會非常有幫助。 我真的很想一次上傳成批的話語。

在實體值中,我輸入了“pet:pet”,它起作用了。

似乎實體字段需要“實體”和“角色”。 角色不必與實體相同,但需要對其進行定義。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM