How to translate English to French Text in Node.JS using Deep Learning AI

Deep Learning AI has progressed amazingly in recent years to the point where computer language translations can actually compete with professional human interpreters. Normally, this would take weeks to set up, involving the training of the AI, and dealing with numerous other technical problems that might come up during that process. Thankfully, for those of us who don’t have weeks to work on this issue, we have a solution for you. Today, we will be using an API to solve this problem in just a couple minutes.

We shall begin by installing our client with this command for npm:

npm install cloudmersive-nlp-api-client --save

Next, we just need to set up our function call, which you can see demonstrated in this example below.

var CloudmersiveNlpApiClient = require('cloudmersive-nlp-api-client');var defaultClient = CloudmersiveNlpApiClient.ApiClient.instance;// Configure API key authorization: Apikeyvar Apikey = defaultClient.authentications['Apikey'];Apikey.apiKey = 'YOUR API KEY';// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)//Apikey.apiKeyPrefix = 'Token';var apiInstance = new CloudmersiveNlpApiClient.LanguageTranslationApi();var input = new CloudmersiveNlpApiClient.LanguageTranslationRequest(); // LanguageTranslationRequest | Input translation requestvar callback = function(error, data, response) {if (error) {console.error(error);} else {console.log('API called successfully. Returned data: ' + data);}};apiInstance.languageTranslationTranslateEngToFra(input, callback);

Now just enter in the English phrase that you would like to use and give it a quick run. You will then get back your French translation. Congratulations, you now have the power of a Deep Learning AI to do all your translation work for you. Let’s give it a quick try on this phrase: “This croissant is absolutely stunning!”

"Successful": true,
"TranslatedTextResult": "Ce croissant est absolument étonnant !",
"SentenceCount": 1
Image for post

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

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