How to Spell Check a Sentence in Node.JS with NLP

Spellchecking is truly a lifesaver, especially in this day and age when a huge amount of written content is tapped out on tiny phone screens. Setting up a spellcheck system is no easy task, which is why I’ve already done it for you. All you have to do is call it from an API. Here’s how to do it.

Install our client with this command for npm install:

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

Then call spellcheckCheckSentence:

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.SpellcheckApi();var value = new CloudmersiveNlpApiClient.CheckSentenceRequest(); // CheckSentenceRequest | Input sentencevar callback = function(error, data, response) {if (error) {console.error(error);} else {console.log('API called successfully. Returned data: ' + data);}};apiInstance.spellcheckCheckSentence(value, callback);

Input your sentence to try, and voila, the API will return your results as a JSON file. So easy!

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