For today’s tutorial, we are going to cover pronoun filtering in Python. Normally this would require some pretty hefty NLP programming time to get off the ground, but not today. No, today we are busting out an API that is already fully equipped to pluck you from the jaws of tedium and perform the task for you. Let’s look at how the setup works.
Install the client as your first step:
pip install git+https://github.com/Cloudmersive/Cloudmersive.APIClient.Python.NLP.git
Now we are going to instantiate our API, followed by calling our function using this instance, and providing it with a key and string to work with.
from __future__ import print_functionimport timeimport cloudmersive_nlp_api_clientfrom cloudmersive_nlp_api_client.rest import ApiExceptionfrom pprint import pprint# Configure API key authorization: Apikeyconfiguration = cloudmersive_nlp_api_client.Configuration()configuration.api_key['Apikey'] = 'YOUR_API_KEY'# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed# configuration.api_key_prefix['Apikey'] = 'Bearer'# create an instance of the API classapi_instance = cloudmersive_nlp_api_client.WordsApi(cloudmersive_nlp_api_client.ApiClient(configuration))input = 'input_example' # str | Input stringtry:# Returns all pronounts in stringapi_response = api_instance.words_pronouns(input)pprint(api_response)except ApiException as e:print("Exception when calling WordsApi->words_pronouns: %s\n" % e)
And would you believe it, that’s all there is to it.