Part-of-Speech Tag a String, Filter to Nouns in Python

In this article we’ll run through another useful iteration of the Cloudmersive NLP API v2 & show you how to connect in Python. In our last article we highlighted an iteration of this API which can Part-of-speech (POS) tag a text string for verbs; now, we’ll run through a similar version designed to POS tag nouns & return a JSON result. It’s simple and easy to use, and you can find all of the below code snippets on the Cloudmersive API console page for further reference.

To get started, the first step is to install the Python SDK via the below command:

pip install cloudmersive-nlp-api-clientfrom __future__ import print_function
import time
import cloudmersive_nlp_api_client
from import ApiException
from pprint import pprint

Next, you’ll need to authorize your API key (which can be obtained 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'

Then, finally, we can enter the rest of the function to call the API:

# create an instance of the API class
api_instance = cloudmersive_nlp_api_client.PosTaggerApi(cloudmersive_nlp_api_client.ApiClient(configuration))
request = cloudmersive_nlp_api_client.PosRequest() # PosRequest | Input string
# Part-of-speech tag a string, filter to nouns
api_response = api_instance.pos_tagger_tag_nouns(request)
except ApiException as e:
print("Exception when calling PosTaggerApi->pos_tagger_tag_nouns: %s\n" % e)




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

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Career in EssBase

GSoC’20 @OpenMRS | Coding Period | Week 6

Google URL Shortener API discontinued -Replacement Options

Why Every Professional Should Create An Online Course

Aleo — project overview.

Print to “PRE-PRINTED” set of forms using Jasper Reports without a Database, in Java

Asset image inside the pdf in flutter/dart

Hacker Rank Developer Survey 2018

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


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

More from Medium

Part-of-speech Tag a String, Filter to Verbs in Python

Dockerize & Deploy your Machine Learning model

How to Update/Partial Update data in Elasticsearch Using Python Client

Easier Python Package Deploying