Get Adverbs from an Input Text String using Java: NLP API

Cloudmersive
1 min readApr 12, 2022

--

Our NLP API contains dozens of iterations designed to help your application understand the meaning of unstructured text. The Adverb detection iteration of this API will pull adverbs from an input text string and return them in a list for your convenience. Creating a custom-code connection is easy; just follow steps below for using Java/Maven, or visit our Cloudmersive API Console page to find code snippets available in a dozen other programming languages under the /nlp/get/words/adverbs/string dropdown menu.

To install the Java SDK with Maven, first add a reference to the pom.xml repository:

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

Then add one to the dependency:

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

Lastly, use the below code to add the import classes and call the 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.WordsApi;
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");
WordsApi apiInstance = new WordsApi();
String input = "input_example"; // String | Input string
try {
String result = apiInstance.wordsAdverbs(input);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling WordsApi#wordsAdverbs");
e.printStackTrace();
}

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

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

No responses yet