Exemplo n.º 1
0
 def test_overrides(self):
     b = tb.Blobber(tokenizer=SentenceTokenizer(),
                    np_extractor=ConllExtractor())
     blob = b("How now? Brown cow?")
     assert_true(isinstance(blob.tokenizer, SentenceTokenizer))
     assert_equal(blob.tokens, tb.WordList(["How now?", "Brown cow?"]))
     blob2 = b("Another blob")
     # blobs have the same tokenizer
     assert_true(blob.tokenizer is blob2.tokenizer)
     # but aren't the same object
     assert_not_equal(blob, blob2)
Exemplo n.º 2
0
 def test_overrider_classifier(self):
     b = tb.Blobber(classifier=classifier)
     blob = b("I am so amazing")
     assert_equal(blob.classify(), 'pos')
Exemplo n.º 3
0
 def test_override_analyzer(self):
     b = tb.Blobber(analyzer=NaiveBayesAnalyzer())
     blob = b("How now?")
     blob2 = b("Brown cow")
     assert_true(isinstance(blob.analyzer, NaiveBayesAnalyzer))
     assert_true(blob.analyzer is blob2.analyzer)
Exemplo n.º 4
0
 def setUp(self):
     self.blobber = tb.Blobber()  # The default blobber