How to Spellcheck a Word in Node.JS

Cloudmersive
Oct 27, 2020

--

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.

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) {
console.error(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.

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

No responses yet