【发布时间】:2018-10-05 20:22:42
【问题描述】:
在培训翻译后,我从 Microsoft 自定义翻译获得了类别 ID。现在我不知道需要插入到我已经拥有的文本翻译 API 中的脚本。
此处粘贴的示例代码。我刚刚输入了如下所示的类别 ID,但是,不确定启用它的正确脚本是什么。
代码示例:
# Replace the SUBSCRIPTION_KEY string value with your valid subscription key.
`SUBSCRIPTION_KEY = 'xxxx' #Place your subscription key here
HOST = 'api.cognitive.microsofttranslator.com'
PATH = '/translate?api-version=3.0'
`
# Replace the CATEGORY string value with your valid ID that you obtain from the Microsoft Custom Translator
`CATEGORY = 'xxxx'`
# Translation from to parameter
`PARAMS = "&from=en&to=de"`
【问题讨论】:
-
分类是url上的参数。所以你的参数字符串应该是 '&from=en&to=de&category=xxxx