Translate German to English text with Deep Learning AI in Python
Linguistic detection and translation capabilities are key features of the Cloudmersive NLP API v2. In this article we’ll run through an iteration of this API — /nlp-v2/translate/deu/to/eng — which provides an automatic translation of German text into English, using advanced Deep Learning and Neural NLP. As always, all you need to do is follow directions to copy & paste the ready-to-run code provided below (directly from the Cloudmersive API console page).
To get started using this API in Python, you’ll need to install the Python SDK with this snippet:
pip install cloudmersive-nlp-api-clientfrom __future__ import print_function
import time
import cloudmersive_nlp_api_client
from cloudmersive_nlp_api_client.rest import ApiException
from pprint import pprint
Then you can authorize API access by inputting your API key into the below code:
# Configure API key authorization: Apikey
configuration = cloudmersive_nlp_api_client.Configuration()
configuration.api_key['Apikey'] = 'YOUR_API_KEY'
Finally, all that’s left is copying in the callback function code itself and you’re all set. Hoffe, das hat geholfen!
# 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 German to English text with Deep Learning AI
api_response = api_instance.language_translation_translate_deu_to_eng(input)
pprint(api_response)
except ApiException as e:
print("Exception when calling LanguageTranslationApi->language_translation_translate_deu_to_eng: %s\n" % e)