How to perform Named Entity Recognition NER in C# .NET Framework with NLP

Trying to set up a means of recognizing named entities (NER) is quite a difficult task in C#. There’s no easy way to deal with all of the potential special cases and other pitfalls. Using the power of NLP, we will be solving this problem for you once and for all, and doing so after but a few minutes of easy setup time.

First we are going to use NuGet to grab our package with this command:

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

Now we just need to call our NER 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 ExtractEntitiesPostExample{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 ExtractEntitiesApi();var value = new ExtractEntitiesRequest(); // ExtractEntitiesRequest | Input stringtry{// Extract entities from stringExtractEntitiesResponse result = apiInstance.ExtractEntitiesPost(value);Debug.WriteLine(result);}catch (Exception e){Debug.Print("Exception when calling ExtractEntitiesApi.ExtractEntitiesPost: " + e.Message );}}}}

Done!

Image for post
Image for post

Written by

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