How to Part-Of-Speech POS Tag a String in C# .NET Framework

Cloudmersive
1 min readJul 15, 2020

--

POS tagging is a necessary part of performing many language analysis routines, but it is quite a complex problem to get set up in C#. To help combat this difficulty, we will be showing you an ultra-fast shortcut. This will involve using an API, which will cut down our initial time investment significantly.

First we go ahead and download the package that we need.

Install-Package Cloudmersive.APIClient.NET.NLP -Version 4.0.9

Now go ahead and call the following function:

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 PosTaggerStringPostExample{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 PosTaggerStringApi();var input = input_example;  // string | Input stringtry{// Part-of-speech tag a stringstring result = apiInstance.PosTaggerStringPost(input);Debug.WriteLine(result);}catch (Exception e){Debug.Print("Exception when calling PosTaggerStringApi.PosTaggerStringPost: " + e.Message );}}}}

Done! Super simple.

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

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

No responses yet