当我们查询翻译API时
https://translation.googleapis.com/language/translate/v2?key=$API_KEY&q=hello&source=en&target=e
我只有1个结果:
{
"data": {
"translations": [
{
"translatedText": "....."
}
]
}
}
是否有可能获得该单词的所有变体(替代形式),而不仅是一次翻译?
答案 0 :(得分:1)
翻译API服务不支持检索一个单词的多个翻译,如FAQ Documentation中所述:
是否可以对一个单词进行多次翻译? 否。此功能仅可通过以下网址的网络界面使用: translate.google.com
如果此功能不能满足您的当前需求,则可以使用service public documentation左下角和右上角的发送反馈按钮,以及查看Issue Tracker工具,以便raise a Translation API feature request并通知Google有关所需的功能。
答案 1 :(得分:1)
Microsoft Azure支持一个。 https://docs.microsoft.com/en-us/azure/cognitive-services/translator/reference/v3-0-dictionary-lookup。
例如https://api.cognitive.microsofttranslator.com/dictionary/lookup?api-version=3.0&from=en&to=es
[
{"Text":"hello"}
]
为您提供这样的翻译列表:
[
{
"normalizedSource": "hello",
"displaySource": "hello",
"translations": [
{
"normalizedTarget": "diga",
"displayTarget": "diga",
"posTag": "OTHER",
"confidence": 0.6909,
"prefixWord": "",
"backTranslations": [
{
"normalizedText": "hello",
"displayText": "hello",
"numExamples": 1,
"frequencyCount": 38
}
]
},
{
"normalizedTarget": "dime",
"displayTarget": "dime",
"posTag": "OTHER",
"confidence": 0.3091,
"prefixWord": "",
"backTranslations": [
{
"normalizedText": "tell me",
"displayText": "tell me",
"numExamples": 1,
"frequencyCount": 5847
},
{
"normalizedText": "hello",
"displayText": "hello",
"numExamples": 0,
"frequencyCount": 17
}
]
}
]
}
]
在这种情况下,您可以看到2种不同的翻译。