How to paraphrase or rephrase English Text Sentences in Node.JS using Deep Learning AI

Deep Learning has advanced to such a point that it can be used to completely rewrite English sentences, while preserving the meaning. This can be used to great effect as part of a writing app or website, among other things. If you are not about to spend the next few weeks training your own AI, then I have the next best thing: an API that already has one. Here’s how to use it.

This dependency reference will import our Natural Language Processing Client.

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

Now we can call rephraseTranslateDeuToEng, as shown below. This just means instancing the API and using it for the function call.

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.RephraseApi();var input = new CloudmersiveNlpApiClient.RephraseRequest(); // RephraseRequest | Input rephrase requestvar callback = function(error, data, response) {if (error) {console.error(error);} else {console.log('API called successfully. Returned data: ' + data);}};apiInstance.rephraseTranslateDeuToEng(input, callback);

And there you have it. The RephraseRequest should contain your sentence as a string, as well as the number of rephrasings that you would like. Done! Our NLP library also contains functions for translating text using Deep Learning, as well as POS tagging, language detection, and even detecting profanities.

Image for post
Image for post

Written by

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