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

Deep Learning AIs are offering the next level of computational linguistics, providing amazing grammatical fidelity. You probably don’t have weeks to spend training a neural network in NLP, though. Well, this solution is for you, then. I have already created the AI that we need, and can provide you access using a simple API call.

Here’s the dependency reference for our NLP client.

"dependencies": {
"cloudmersive-nlp-api-client": "^1.1.2"
}

Now we shall call languageTranslationTranslateDeuToEng via a newly created API instance. Here’s how that should look:

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.languageTranslationTranslateDeuToEng(input, callback);

And now you can translate anything you like from German to English! So easy. For English to German, you can call languageTranslationTranslateEngToDeu, which exists in the same library, along with many other useful language processing functions, such as part-of-speech tagging and spell checking.

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