Ejemplo n.º 1
0
def test_split_data_target():
    classifier = ReviewClassifier('nn')
    dataset = classifier.create_dataset('test-reviews.csv')
    train_data, train_target = classifier.split_data_target(dataset)
    assert len(train_data) == len(train_target)
    assert train_data[0][0] in [0, 1]
    assert train_target[0] in [0, 1]
Ejemplo n.º 2
0
def test_create_dataset():
    classifier = ReviewClassifier('nb')
    dataset = classifier.create_dataset('test-reviews.csv')
    assert list(dataset[0][0].values())[0]
    assert dataset[0][1] == 'pos'
    assert dataset[-1][1] == 'neg'
Ejemplo n.º 3
0
def test_create_trained_model_nb():
    """Test create train model for naive bayes"""
    classifier = ReviewClassifier('nb')
    dataset = classifier.create_dataset('test-reviews.csv')
    model = classifier.create_trained_model(dataset=dataset)
    assert model