Detect Langauge of Text in C#

Break the language barrier with the Language Detection iteration of our NLP API. Find out if input text is written in any one of more than a dozen common languages — including English, French, Japanese, German, and more. Check out how you can connect easily in C# using code below from the Cloudmersive API Console.

Use this command & code snippet to install the .NET framework SDK:

Install-Package Cloudmersive.APIClient.NET.NLP -Version 4.1.0using System;
using System.Diagnostics;
using Cloudmersive.APIClient.NET.NLP.Api;
using Cloudmersive.APIClient.NET.NLP.Client;
using Cloudmersive.APIClient.NET.NLP.Model;

Or, for .NET Core, use this instead:

Install-Package Cloudmersive.APIClient.NETCore.NLP -Version 2.1.3using System;
using System.Diagnostics;
using Cloudmersive.APIClient.NETCore.NLP.Api;
using Cloudmersive.APIClient.NETCore.NLP.Client;
using Cloudmersive.APIClient.NETCore.NLP.Model;

Finally, wrap things up by copying the below code & including your API key where indicated. Head to the Cloudmersive website and make a free account (with no financial commitments) to receive your key.

namespace Example
{
public class LanguageDetectionGetLanguageExample
{
public void main()
{
// Configure API key authorization: Apikey
Configuration.Default.AddApiKey("Apikey", "YOUR_API_KEY");
var apiInstance = new LanguageDetectionApi();
var input = new LanguageDetectionRequest(); // LanguageDetectionRequest |
try
{
// Detect language of text
LanguageDetectionResponse result = apiInstance.LanguageDetectionGetLanguage(input);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling LanguageDetectionApi.LanguageDetectionGetLanguage: " + e.Message );
}
}
}
}

--

--

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