示例#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)
示例#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)
示例#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])
示例#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])
示例#5
0
 def setUp(self):
     self.analyzer = PatternAnalyzer()
示例#6
0
 def setUp(self):
     self.analyzer = PatternAnalyzer()