How to translate English to French Text in Python using Deep Learning AI
Deep Learning has been moving forward by leaps and bounds in recent years. It’s capabilities have reached a startling level of accuracy as far as language is concerned, with near flawless translation capabilities. If you have ever tried to set up and train such an AI, however, you surely know the sheer time investment that they require. Today, on the other hand, that is not a concern, as we have a Deep Learning AI ready for all the English to French translations you can throw at it.
This AI is accessible through an API, which we will install the client for now.
pip install git+https://github.com/Cloudmersive/Cloudmersive.APIClient.Python.NLP.git
And the next step is a function call like this:
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 French text with Deep Learning AIapi_response = api_instance.language_translation_translate_eng_to_fra(input)pprint(api_response)except ApiException as e:print("Exception when calling LanguageTranslationApi->language_translation_translate_eng_to_fra: %s\n" % e)
And there you have it! Easy as pie! Or should I say croissant?