How to Spellcheck a Word in Node.JS

When allowing input or search queries from users on your platform, you may run the risk of your systems not understanding the text due to spelling errors. Furthermore, if you are creating a writing application like Grammarly, your systems must be able to detect misspellings and suggest properly spelled options for your users. To do this, the following API will allow you to spellcheck words and provide suggestions for corrections as JSON using Natural Language Processing.

Image for post
Image for post

To start our function, we need to run the following command to install the SDK:

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

You may also add this snippet to your package.json:

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

Then, we can call our function:

var CloudmersiveNlpApiClient = require('cloudmersive-nlp-api-client');
var defaultClient = CloudmersiveNlpApiClient.ApiClient.instance;
// Configure API key authorization: Apikey
var Apikey = defaultClient.authentications['Apikey'];
Apikey.apiKey = 'YOUR API KEY';
var apiInstance = new CloudmersiveNlpApiClient.SpellcheckApi();var value = new CloudmersiveNlpApiClient.CheckWordRequest(); // CheckWordRequest | Input stringvar callback = function(error, data, response) {
if (error) {
} else {
console.log('API called successfully. Returned data: ' + data);
apiInstance.spellcheckCorrectJson(value, callback);

Now, your platform will be able to instantly check the spelling of input text and improve your site’s user experience.

The API Key for this function is free with no commitments on the Cloudmersive website. This will give you access to 800 calls per month across our entire API library.

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