def test_classify_nn(): """Test classify using nn""" classifer = ReviewClassifier('nn') classifer.load_model(tar_file='test_nn_model.tar') classifer.classify('classified_comments.txt', comments_filename='test-reviews.csv') assert os.path.exists('classified_comments.txt') os.remove('classified_comments.txt')
def test_classify_nb_from_csv(): """Test classify using nb model from csv file""" classifer = ReviewClassifier('nb') classifer.load_model(pickle_file='test_nb_model.pickle') classifer.classify('classified_comments.txt', comments_filename='test-reviews.csv') assert os.path.exists('classified_comments.txt') os.remove('classified_comments.txt')
def test_classify_rf(): """Test classify using rf""" classifer = ReviewClassifier('rf') classifer.load_model(pickle_file='test_rf_model.pickle') classifer.classify('classified_comments.txt', comments_filename='test-reviews.csv') assert os.path.exists('classified_comments.txt') os.remove('classified_comments.txt')
def test_classify_from_text_file(): """Test classify comments text file""" classifer = ReviewClassifier('nb') classifer.load_model(pickle_file='test_nb_model.pickle') classifer.classify('classified_comments.txt', comments_text_file='neutral.txt') assert os.path.exists('classified_comments.txt') os.remove('classified_comments.txt')