How to Spell Check a Word and get the results as a JSON in Node.JS

Setting up a spell checker can definitely be a headache. Believe me, I know, I just wrote one out. Luckily for you, I’ve made it into a lovely API that can be used with just a few lines of code. Let me show you.

We begin by installing the NLP client with this reference for package.json.

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

Now call spellCheckCheckJson:

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 = "value_example"; // String | Input sentencevar callback = function(error, data, response) {if (error) {console.error(error);} else {console.log('API called successfully. Returned data: ' + data);}};apiInstance.spellCheckCheckJson(value, callback);

Input a string to get your spell check results as a JSON file. It’s as simple as that. For more amazingly practical APIs like this one, spare a glance at the documentation section for the NLP client.

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