How to translate German to English Text in Python using Deep Learning AI
With the amazing power of Deep Learning, computer translation has never been better. To take advantage of this, you would normally need a bleeding edge graphics card to perform the training process, not to mention the days or even weeks spent on this. Luckily, there is another way that is much faster. How about we achieve these results in just a few minutes instead?
To begin the process, install this client:
pip install git+https://github.com/Cloudmersive/Cloudmersive.APIClient.Python.NLP.git
Next will be our API function call: language_translation_translate_deu_to_eng. This will use an API instance, which we can create with a key. This function will take in a translation request object that contains our text for translation as an argument. For reference, see below:
from __future__ import print_functionimport timeimport cloudmersive_nlp_api_clientfrom cloudmersive_nlp_api_client.rest import ApiExceptionfrom pprint import pprint# Configure API key authorization: Apikeyconfiguration = cloudmersive_nlp_api_client.Configuration()configuration.api_key['Apikey'] = 'YOUR_API_KEY'# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed# configuration.api_key_prefix['Apikey'] = 'Bearer'# create an instance of the API classapi_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 AIapi_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)
And that is all that needs to be done! Super easy.