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

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-client

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

--

--

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

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
Cloudmersive

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