Translate English to German Text with Deep Learning API
In our last article, we covered how you can use the Cloudmersive NLP API v2 to translate text from German to English in the blink of an eye. In this article we’ll look at the opposite transition. No surprise here, but the /nlp-v2/translate/eng/to/deu iteration is just as simple & easy to use as its inverse predecessor.
First, you’ll have to get the Python SDK set up & installed the following code:
pip install cloudmersive-nlp-api-clientfrom __future__ import print_function
from cloudmersive_nlp_api_client.rest import ApiException
from pprint import pprint
Next, you can copy in the API key authorization code snippet. You can retrieve this API key by registering for a free account on the Cloudmersive website (this provides 800 monthly calls across our library of APIs).
# Configure API key authorization: Apikey
configuration = cloudmersive_nlp_api_client.Configuration()
configuration.api_key['Apikey'] = 'YOUR_API_KEY'
Finally, you can copy in the callback function code, and you’re off to the races:
# create an instance of the API class
api_instance = cloudmersive_nlp_api_client.LanguageTranslationApi(cloudmersive_nlp_api_client.ApiClient(configuration))
input = cloudmersive_nlp_api_client.LanguageTranslationRequest() # LanguageTranslationRequest | Input translation requesttry:
# Translate English to German text with Deep Learning AI
api_response = api_instance.language_translation_translate_eng_to_deu(input)
except ApiException as e:
print("Exception when calling LanguageTranslationApi->language_translation_translate_eng_to_deu: %s\n" % e)