在翻译文本API中使用Microsoft自定义翻译器类别ID

时间:2018-09-06 10:50:27

标签: microsoft-translator

经过培训,我从Microsoft Custom Translator获得了类别ID。现在,我不知道需要在已经拥有的Translator Text 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"`

1 个答案:

答案 0 :(得分:0)

您可以将类别传递给dst1,如下所示:

dst2ind