How to Spell Check a Word and get the results as a JSON in Python

In today’s world of smart phone typos, spell check has become more important than ever before. Setting up such as system, however, is a complete and total drag, let me tell you. But let me also tell you that there is a way out from this drudgery. Allow me to demonstrate.

We start with pip installation of our NLP client:

pip install git+

Then move on to our function call:

from __future__ import print_functionimport timeimport cloudmersive_nlp_api_clientfrom import ApiExceptionfrom pprint import pprint# Configure API key authorization: Apikeyconfiguration = cloudmersive_nlp_api_client.Configuration()configuration.api_key['Apikey'] = 'YOUR_API_KEY'# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed# configuration.api_key_prefix['Apikey'] = 'Bearer'# create an instance of the API classapi_instance = cloudmersive_nlp_api_client.SpellCheckApi(cloudmersive_nlp_api_client.ApiClient(configuration))value = 'value_example' # str | Input wordtry:# Spell check wordapi_response = api_instance.spell_check_check_json(value)pprint(api_response)except ApiException as e:print("Exception when calling SpellCheckApi->spell_check_check_json: %s\n" % e)

Now we can enter in our word as a string and run the code. The API will respond back in JSON format, informing us if the word is spelled correctly or not. Simple!

Image for post

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