How to Perform Subjectivity and Objectivity Analysis on Text with JavaScript

Whether you’re doing NLP research on text, or just looking to include an NLP operation in your app, the Cloudmersive Subjectivity Analysis API can be a useful asset. Subjectivity Analysis is all about determining how objective or subjective a given body of text is based on its rhetoric, and our API will provide a score between 0.0 and 1.0, with higher numbers indicating a higher probability of subjectivity.

Interested in using this API? Just follow instructions provided below to structure your API call in JavaScript. To authenticate access, get a Cloudmersive API key by registering a free account on our website.

Let’s begin by installing the jQuery library, using the following command:

bower install jquery

After that, let’s include the following code snippets to structure the API call:

var settings = {
"url": "https://api.cloudmersive.com/nlp-v2/analytics/subjectivity",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "application/x-www-form-urlencoded",
"Apikey": "YOUR-API-KEY-HERE"
},
"data": {
"TextToAnalyze": "<string>"
}
};
$.ajax(settings).done(function (response) {
console.log(response);
});

No further code required — you’re all done.

--

--

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

437 Followers

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