语言检测总是 returns 1 个结果

Language detection always returns 1 result

我在让语言检测工作时遇到了问题。根据 Microsoft's website 上的文档,当服务不确定输入字符串是哪种语言时,我应该能够获得多种语言。但是,我总是只收到一种语言。在下面的示例中,我使用了 "Hallo",在德语和荷兰语中都是 "Hello"。此外,对于 "Bier" 这样的其他词,在德语和荷兰语中是 "Beer",该服务只给出一个结果,尽管 numberOfLanguages 查询参数值为 5.

感谢您的帮助。

要求:

POST https://westus.api.cognitive.microsoft.com/text/analytics/v2.0/languages?numberOfLanguagesToDetect=5 HTTP/1.1
Content-Type: application/json
Host: westus.api.cognitive.microsoft.com
Ocp-Apim-Subscription-Key: ••••••••••••••••••••••••••••••••

{
  "documents": [
    {
      "id": "Test",
      "text": "Hallo"
    }
  ]
}

有了这个回复:

Transfer-Encoding: chunked
x-ms-transaction-count: 0
x-aml-ta-request-id: 4bb2e01e-59a1-4f66-bb31-8ca2c32d262b
X-Content-Type-Options: nosniff
apim-request-id: 65a8d5f5-1394-43cf-89e1-83d7188cb81a
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Date: Tue, 25 Apr 2017 15:18:34 GMT
Content-Type: application/json; charset=utf-8

{
  "documents": [
    {
      "id": "Test",
      "detectedLanguages": [
        {
          "name": "German",
          "iso6391Name": "de",
          "score": 1.0
        }
      ]
    }
  ],
  "errors": []
}

文档已更新以对此进行解释。

numberOfLanguagesToDetect: Format - int32. (Optional. Deprecated) Number of languages to detect. Set to 1 by default. Irrespective of the value, the language with the highest score is returned.