中文文本被错误地识别为葡萄牙语

Chinese text incorrectly identified as Portuguese

当我将一段中文文本传递给 IBM Watson 语言检测方法时,该文本被错误地识别为 pt -- 葡萄牙语:

curl -X POST -d "outputMode=json" \ 
"https://gateway.watsonplatform.net/language-translation/api/v2/identify" \
--data-urlencode "text=中国的工厂" \
--header "content-type: text/plain" \
--user "MY_USERNAME:MY_PASSWORD"

是我对文本编码有误,还是做错了什么?

或者 IBM Watson 的语言识别模型在某些情况下没有用,葡萄牙语作为某种默认值返回?

您指的是已弃用的旧服务。我真的很惊讶你有任何结果。您应该使用的当前服务记录的 API 记录在此处 - https://www.ibm.com/watson/developercloud/language-translator/api/v2/?curl#identify

示例 curl 命令是:

curl -u "{username}":"{password}" \
-H "content-type: text/plain" \
-H "accept: application/json" \
-X POST \
-d "this is a test" \
"https://gateway.watsonplatform.net/language-translator/api/v2/identify"