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)
def test_overrider_classifier(self): b = tb.Blobber(classifier=classifier) blob = b("I am so amazing") assert_equal(blob.classify(), 'pos')
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)
def setUp(self): self.blobber = tb.Blobber() # The default blobber