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

Using the Part-of-Speech (POS) tagger iterations of the Cloudmersive NLP API v2, you can break down any body of text into its various parts-of-speech in the blink of an eye. In this article we’ll cover how you can use an iteration of this API in Python to tag adverbs and return a JSON result. It’s simple and easy to do following the below steps using ready-to-run code.

Starting off you need to install the Python SDK by running the below command:

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

After that you can copy & paste the below snippet to authorize your API key (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'

Finally, you can create the API class instance & call the API with the rest of the function below:

# 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
try:
# Part-of-speech tag a string, filter to adverbs
api_response = api_instance.pos_tagger_tag_adverbs(request)
pprint(api_response)
except ApiException as e:
print("Exception when calling PosTaggerApi->pos_tagger_tag_adverbs: %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

Defining Privileges and Access Control Settings for Pods and Containers in Kubernetes

CSC Developer Update July 2020

Object-Oriented Programming

Suspend AutoScaling For A CloudFormation Stack

Building a bulk sms gateway with Rabbitmq.

Day 49 — Making a start with 3D environment in Unity

How to release microservices in the most efficient way?

Ansible: Easy and Safe SSH deployments from GitHub

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

Cloudmersive

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 Pronouns in Python

Flask Inline Editing with MySql (University Database System)

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

Deciding the best Singleton Approach in Python