我在使用语言检测功能时遇到了麻烦。根据{{3}}上的文档,当服务不确定输入字符串是哪种语言时,我应该能够获得多种语言。但是,我总是只收到一种语言。在下面的例子中,我使用了德语和荷兰语中的“你好”“Hallo”。除了“Bier”这个德语和荷兰语中的“啤酒”之外,该服务只提供一个结果,尽管numberOfLanguages Query参数值为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": []
}
答案 0 :(得分:0)
文档已更新以解释此问题。
numberOfLanguagesToDetect :格式 - int32。 (可选。已弃用)要检测的语言数。默认设置为1。 无论如何 值,返回最高分的语言。