NKK
NKK

Reputation: 1

Using Microsoft Custom Translator Category ID in the Translate Text API

I have got the Category ID from the Microsoft Custom Translator after training the Translator. Now I don't know the script that needs to be inserted in my Translator Text API that I already have.

the sample code pasted here. I have just entered the category ID below as shown, however, not sure what is the right script to enable it.

Code sample:

# 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"`

Upvotes: 0

Views: 530

Answers (1)

Kosho
Kosho

Reputation: 1

You can pass the category to the PARAMS like below:

PARAMS = "&from=en&to=de&category=" + CATEGORY

Upvotes: 0

Related Questions