Perform Subjectivity and Objectivity Analysis on Text in C#

With well-documented code examples from the Cloudmersive API Console, you can easily incorporate useful NLP capabilities into your project. Follow steps below to take advantage of our Subjectivity & Objectivity Analysis API in C#, which will provide you with a subjectivity score result between 0 and 1 (higher numbers indicate more subjective, and lower numbers indicate more objective).

If you’re using .NET, use this command to install your SDK & copy the next snippet to begin the API call:

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;

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;

After that, it’s smooth sailing. Copy the below code to call the API, and input your Cloudmersive API key where indicated. If you don’t have a key yet, you can make a free account on the Cloudmersive website (with zero financial commitments) to get one.

namespace Example
{
public class AnalyticsSubjectivityExample
{
public void main()
{
// Configure API key authorization: Apikey
Configuration.Default.AddApiKey("Apikey", "YOUR_API_KEY");
var apiInstance = new AnalyticsApi();
var input = new SubjectivityAnalysisRequest(); // SubjectivityAnalysisRequest | Input subjectivity analysis request
try
{
// Perform Subjectivity and Objectivity Analysis on Text
SubjectivityAnalysisResponse result = apiInstance.AnalyticsSubjectivity(input);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling AnalyticsApi.AnalyticsSubjectivity: " + 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
Cloudmersive

Cloudmersive

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