How to Part-of-Speech Tag a String and Filter the Adverbs in C# .NET Framework
1 min readJul 18, 2020
POS tagging is a vital part of any computer-driven language analysis operation. In today’s tutorial we will be taking this normally tedious task, and making it into an absolute breeze. We will be able to produce high fidelity results, but with only a handful of minutes invested in getting our solution up and running.
First we will need our package.
Install-Package Cloudmersive.APIClient.NET.NLP -Version 4.0.9
Now we go ahead and call our function like so:
using System;using System.Diagnostics;using Cloudmersive.APIClient.NET.NLP.Api;using Cloudmersive.APIClient.NET.NLP.Client;using Cloudmersive.APIClient.NET.NLP.Model;namespace Example{public class PosTaggerTagAdverbsExample{public void main(){// Configure API key authorization: ApikeyConfiguration.Default.AddApiKey("Apikey", "YOUR_API_KEY");// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed// Configuration.Default.AddApiKeyPrefix("Apikey", "Bearer");var apiInstance = new PosTaggerApi();var request = new PosRequest(); // PosRequest | Input stringtry{// Part-of-speech tag a string, filter to adverbsPosResponse result = apiInstance.PosTaggerTagAdverbs(request);Debug.WriteLine(result);}catch (Exception e){Debug.Print("Exception when calling PosTaggerApi.PosTaggerTagAdverbs: " + e.Message );}}}}
And just like that, our POS operation will be done for us by the API and we will be returned the filtered adverbs.