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

2 min readJan 25, 2022


Pronouns are small but powerful words. In many workplaces, the widespread use of self-directed pronouns has made a major difference in forging a more comfortable environment for its members. For this reason (and for many other reasons), it’s a good thing to know which & how many pronouns are present in any given sentence. Cloudmersive’s NLP API v2 has an iteration capable of finding that out and returning the result as a JSON. In this article, we’ll walk through connecting to this API in Python.

To kick things off, you’ll need to run the command below to install the Python SDK:

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

After that, you can copy in the API Key Authorization snippet & input your key:

# Configure API key authorization: Apikey
configuration = cloudmersive_nlp_api_client.Configuration()
configuration.api_key['Apikey'] = 'YOUR_API_KEY'

Now you’re only one step away — just copy the callback function below to create your instance of the API class:

# 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 pronouns
api_response = api_instance.pos_tagger_tag_pronouns(request)
except ApiException as e:
print("Exception when calling PosTaggerApi->pos_tagger_tag_pronouns: %s\n" % e)




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