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

2 min readJan 21, 2022


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.