Check if Sentence is Spelled Correctly in Python

Cloudmersive’s NLP API v2 allows you to easily add Spellcheck functionality to your application — either for an individual word, or for an entire sentence string. In this article, we’re going to walk through how you can take advantage of the latter iteration in Python and empower your application to check if a sentence is spelled correctly & return a JSON result.

The first step is to copy in the Python SDK installation command:

pip install cloudmersive-nlp-api-client

Now, you can copy in this next snippet which will authorize your Cloudmersive API key (you can get your API key by creating a free account on the Cloudmersive website):

# Configure API key authorization: Apikey
configuration = cloudmersive_nlp_api_client.Configuration()
configuration.api_key['Apikey'] = 'YOUR_API_KEY'

For the final step, all that’s left is to copy in the remainder of the callback function:

# create an instance of the API class
api_instance = cloudmersive_nlp_api_client.SpellcheckApi(cloudmersive_nlp_api_client.ApiClient(configuration))
value = cloudmersive_nlp_api_client.CheckSentenceRequest() # CheckSentenceRequest | Input sentence

--

--

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
Cloudmersive

Cloudmersive

437 Followers

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