How to incorporate NLP Spelling Corrections using Java

Using our Spell Check API, you can seamlessly add an integral NLP layer to your application. Take advantage of code snippets provided below to make a connection with Java, or visit our API Console page to find code available in 12 additional programming languages.

You’ll need to start by installing the Java SDK. To do so using Maven, first add a reference to the repository in pom.xml:

<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>

Directly following that, add one to the dependency in pom.xml:

<dependencies>
<dependency>
<groupId>com.github.Cloudmersive</groupId>
<artifactId>Cloudmersive.APIClient.Java</artifactId>
<version>v4.25</version>
</dependency>
</dependencies>

Last but not least, add the import classes and call the NLP function:

// Import classes:
//import com.cloudmersive.client.invoker.ApiClient;
//import com.cloudmersive.client.invoker.ApiException;
//import com.cloudmersive.client.invoker.Configuration;
//import com.cloudmersive.client.invoker.auth.*;
//import com.cloudmersive.client.SpellcheckApi;
ApiClient defaultClient = Configuration.getDefaultApiClient();// Configure API key authorization: Apikey
ApiKeyAuth Apikey = (ApiKeyAuth) defaultClient.getAuthentication("Apikey");
Apikey.setApiKey("YOUR API KEY");
// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null)
//Apikey.setApiKeyPrefix("Token");
SpellcheckApi apiInstance = new SpellcheckApi();
CheckWordRequest value = new CheckWordRequest(); // CheckWordRequest | Input string
try {
CheckWordResponse result = apiInstance.spellcheckCorrectJson(value);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SpellcheckApi#spellcheckCorrectJson");
e.printStackTrace();
}

--

--

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.