Exemplo n.º 1
0
class TestPatternSentiment(unittest.TestCase):
    def setUp(self):
        self.analyzer = PatternAnalyzer()

    def test_kind(self):
        assert_equal(self.analyzer.kind, CONTINUOUS)

    def test_analyze(self):
        p1 = "I feel great this morning."
        n1 = "This is a terrible car."
        assert_true(self.analyzer.analyze(p1)[0] > 0)
        assert_true(self.analyzer.analyze(n1)[0] < 0)
Exemplo n.º 2
0
class TestPatternSentiment(unittest.TestCase):

    def setUp(self):
        self.analyzer = PatternAnalyzer()

    def test_kind(self):
        assert_equal(self.analyzer.kind, CONTINUOUS)

    def test_analyze(self):
        p1 = "I feel great this morning."
        n1 = "This is a terrible car."
        assert_true(self.analyzer.analyze(p1)[0] > 0)
        assert_true(self.analyzer.analyze(n1)[0] < 0)
Exemplo n.º 3
0
 def test_can_get_subjectivity_and_polarity_with_different_analyzer(self):
     blob = tb.TextBlob("I love this car.", analyzer=NaiveBayesAnalyzer())
     pattern = PatternAnalyzer()
     assert_equal(blob.polarity, pattern.analyze(str(blob))[0])
     assert_equal(blob.subjectivity, pattern.analyze(str(blob))[1])
Exemplo n.º 4
0
 def test_can_get_subjectivity_and_polarity_with_different_analyzer(self):
     blob = tb.TextBlob("I love this car.", analyzer=NaiveBayesAnalyzer())
     pattern = PatternAnalyzer()
     assert_equal(blob.polarity, pattern.analyze(str(blob))[0])
     assert_equal(blob.subjectivity, pattern.analyze(str(blob))[1])
Exemplo n.º 5
0
 def setUp(self):
     self.analyzer = PatternAnalyzer()
Exemplo n.º 6
0
 def setUp(self):
     self.analyzer = PatternAnalyzer()