How to Part-of-Speech Tag a String & Filter to Verbs (Only) using Node.js

2 min readJul 19, 2022

Our NLP API endpoint offers a variety of options to analyze, parse and categorize unstructured text. With our Verb POS-tagger API iteration, you can quickly filter an input text string into a JSON containing only the verbs within that sentence (clearly labeled as such). With this information, you can inform linguistic/statistical models with greater context and therefore greater accuracy.

Below, we’ll walk through how to structure your API call using Node.js code snippets. First, however, you should register a free account on our website if you don’t have one — this will give you the API key you need to authenticate the operation (which comes with 800 free uses per month).

To begin, let’s install the Node.js SDK:

npm install cloudmersive-nlp-api-client --save

Next, let’s include the following two snippets (your API key must be included in the latter of the two):

var CloudmersiveNlpApiClient = require('cloudmersive-nlp-api-client');
var defaultClient = CloudmersiveNlpApiClient.ApiClient.instance;
// Configure API key authorization: Apikey
var Apikey = defaultClient.authentications['Apikey'];
Apikey.apiKey = 'YOUR API KEY';

Now let’s wrap up by calling the function:

var apiInstance = new CloudmersiveNlpApiClient.PosTaggerApi();var request = new CloudmersiveNlpApiClient.PosRequest(); // PosRequest | Input stringvar callback = function(error, data, response) {
if (error) {
} else {
console.log('API called successfully. Returned data: ' + data);
apiInstance.posTaggerTagVerbs(request, callback);

Just like that, you’re all done — no more code required!




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