0
$\begingroup$

I have a CSV file having a bunch of sentences related to science. Before I do sentiment analysis on the sentences I want to programatically decide whether sentiment analysis is required on the sentence or not.

Basically some of the sentences are opinions of a particular topic in which case doing sentiment analysis makes sense. However some of the sentences are just definitions and sentiment analysis is not required on such sentences. So is there any way to detect the presence of a sentiment in a sentence?

(Note that the length of a sentence varies from 9 to 30 words.)

$\endgroup$
1
  • 2
    $\begingroup$ Train a separate classifier to determine the presence of opinion. $\endgroup$
    – Emre
    Commented Jul 3, 2017 at 7:58

1 Answer 1

1
$\begingroup$

TextBlob, a Python package, does this (and much more). It uses a pre-trained model, thus requires no training. Given a sentence, TextBlob will return the polarity from -1 to 1. -1 is negative, 1 is positive, 0 is neutral. It will also return subjectivity from 0 (very objective) to 1 (very subjective).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.