How to Perform Subjectivity and Objectivity Analysis on Text with JavaScript

Cloudmersive
1 min readMay 21, 2022

--

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.

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

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

No responses yet