How to translate English to Russian Text in Python using Deep Learning AI

There has never been a better time for performing language translations with a computer. Deep Learning AI has revolutionized the field, providing human-level quality for translations in many different languages. To avoid the multiple-week-long training process, I will be showing you how to access an already trained AI through use of an API. In this way, we will have you up and running with English to Russian translations in just a few minutes.

So let’s begin by first installing the NLP API client, like so:

pip install git+https://github.com/Cloudmersive/Cloudmersive.APIClient.Python.NLP.git

With that out of the way, we can move on to calling language_translation_translate_eng_to_rus, as you can see right here.

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 English to Russian text with Deep Learning AIapi_response = api_instance.language_translation_translate_eng_to_rus(input)pprint(api_response)except ApiException as e:print("Exception when calling LanguageTranslationApi->language_translation_translate_eng_to_rus: %s\n" % e)

Alright, that’s it! You now have cutting edge language translation just an API call away. You can also use this library for translating from Russian back to English, as well as support for other languages and some general NLP functions.

Image for post
Image for post

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store