How to Extract Sentences from a String in C# .NET Framework with NLP

Today we will be harnessing the power of Natural Language Processing to separate strings into their component sentences. This would normally be quite a chore to get set up for C# users, but we will be taking a shortcut today. This will allow us to not only achieve top quality results, but also be done in just a matter of minutes, rather than the numerous hours that would usually be required.

First we are going to install our package using NuGet:

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

Now we call our function like this here:

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 SentencesPostExample{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 SentencesApi();var input = input_example;  // string | Input stringtry{// Extract sentences from stringstring result = apiInstance.SentencesPost(input);Debug.WriteLine(result);}catch (Exception e){Debug.Print("Exception when calling SentencesApi.SentencesPost: " + e.Message );}}}}

And done!

Image for post

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