com.aliasi.test.unit.classify.NaiveBayesClassifierTest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aliasi-lingpipe Show documentation
Show all versions of aliasi-lingpipe Show documentation
This is the original Lingpipe:
http://alias-i.com/lingpipe/web/download.html
There were not made any changes to the source code.
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