Ejemplo n.º 1
0
    def analyze(self, text, keep_assessments=False):
        """Return the sentiment as a named tuple of the form:
        ``Sentiment(polarity, subjectivity, [assessments])``.
        """
        #: Return type declaration
        if keep_assessments:
            Sentiment = namedtuple('Sentiment', ['polarity', 'subjectivity', 'assessments'])
            assessments = pattern_sentiment(text).assessments
            polarity, subjectivity = pattern_sentiment(text)
            return Sentiment(polarity, subjectivity, assessments)

        else:
            Sentiment = namedtuple('Sentiment', ['polarity', 'subjectivity'])
            return Sentiment(*pattern_sentiment(text))
Ejemplo n.º 2
0
 def analyze(self, text):
     """Return the sentiment as a named tuple of the form:
     ``Sentiment(polarity, subjectivity)``.
     """
     return self.RETURN_TYPE(*pattern_sentiment(text))
Ejemplo n.º 3
0
 def analyze(self, text):
     """Return the sentiment as a tuple of the form:
     ``(polarity, subjectivity)``
     """
     return pattern_sentiment(text)
Ejemplo n.º 4
0
 def analyze(self, text):
     """Return the sentiment as a named tuple of the form:
     ``Sentiment(polarity, subjectivity)``.
     """
     return self.RETURN_TYPE(*pattern_sentiment(text))
Ejemplo n.º 5
0
 def analyze(self, text):
     """Return the sentiment as a tuple of the form:
     ``(polarity, subjectivity)``
     """
     return pattern_sentiment(text)