How to Spell Check a Word and get the results as a JSON in C# .NET Framework

Cloudmersive
2 min readJul 17, 2020

--

Today our goal is to set up a spell checking solution in C#, one that will return a JSON that contains a list of potential alternate spellings and other information. Instead of dealing with a bunch of spelling databases and try to figure out how to reconcile each character’s location on the keyboard with our accuracy data, we will be doing this the easy way. This will only take a couple minutes to get set up, from start to finish.

First we need our package:

Install-Package Cloudmersive.APIClient.NET.NLP -Version 4.0.9

Now we call our spellcheck function:

using System;using System.Diagnostics;using Cloudmersive.APIClient.NET.NLP.Api;using Cloudmersive.APIClient.NET.NLP.Client;using Cloudmersive.APIClient.NET.NLP.Model;namespace Example{public class SpellCheckCheckJsonExample{public void main(){// Configure API key authorization: ApikeyConfiguration.Default.AddApiKey("Apikey", "YOUR_API_KEY");// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed// Configuration.Default.AddApiKeyPrefix("Apikey", "Bearer");var apiInstance = new SpellCheckApi();var value = value_example;  // string | Input sentencetry{// Spell check wordCheckJsonResponse result = apiInstance.SpellCheckCheckJson(value);Debug.WriteLine(result);}catch (Exception e){Debug.Print("Exception when calling SpellCheckApi.SpellCheckCheckJson: " + e.Message );}}}}

And shortly thereafter we will have our results as a JSON, easy as that!

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

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

No responses yet