All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.aliasi.test.unit.classify.NaiveBayesClassifierTest Maven / Gradle / Ivy

Go to download

This is the original Lingpipe: http://alias-i.com/lingpipe/web/download.html There were not made any changes to the source code.

There is a newer version: 4.1.2-JL1.0
Show newest version
package com.aliasi.test.unit.classify;

import com.aliasi.classify.NaiveBayesClassifier;

import com.aliasi.tokenizer.IndoEuropeanTokenizerFactory;

import org.junit.Test;

import static junit.framework.Assert.assertEquals;


public class NaiveBayesClassifierTest  {

    @Test
    public void testOne() {
    NaiveBayesClassifier classifier
        = new NaiveBayesClassifier(new String[] { "a", "b", "c" },
                                   IndoEuropeanTokenizerFactory.INSTANCE);
    classifier.train("a","John Smith",1);
    classifier.train("a","John Smith",1);
    classifier.train("b","Fred Smith",1);
    classifier.train("b","Fred Smith",1);
    classifier.train("c","Fred Jones",1);
    classifier.train("c","Fred Jones",1);
    
    assertEquals("a",classifier.classify("John Smith").bestCategory());
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy