def test_process_data(self): gimli=Gimli("tests/test1.csv",silent=1,validation_ratio=1) gimli.process(filter_threshold=0) ngram=("b","c") result=gimli.ngram_count.get(ngram,0) expected=[2,1,0,0] self.assertEqual(expected,result) result=gimli.ngram_scores.get(ngram,0) expected=[2/3,1/3,0,0] self.assertEqual(expected,result)
def test_prediction(self): gimli=Gimli("tests/test1.csv",silent=1,validation_ratio=1) gimli.process(filter_threshold=0) text="a b c a b c" result=gimli.get_prediction(text) expected=0 self.assertEqual(expected,result) text="... bob joe jimbo c b a b" result=gimli.get_prediction(text) expected=1 self.assertEqual(expected,result)