public class SimpleNaiveBayesClassifier extends Object implements Classifier<BytesRef>
http://en.wikipedia.org/wiki/Naive_Bayes_classifier
Constructor and Description |
---|
SimpleNaiveBayesClassifier()
Creates a new NaiveBayes classifier.
|
Modifier and Type | Method and Description |
---|---|
ClassificationResult<BytesRef> |
assignClass(String inputDocument)
Assign a class (with score) to the given text String
|
void |
train(AtomicReader atomicReader,
String textFieldName,
String classFieldName,
Analyzer analyzer)
Train the classifier using the underlying Lucene index
|
public SimpleNaiveBayesClassifier()
train()
before you can
classify any documents.public void train(AtomicReader atomicReader, String textFieldName, String classFieldName, Analyzer analyzer) throws IOException
train
in interface Classifier<BytesRef>
atomicReader
- the reader to use to access the Lucene indextextFieldName
- the name of the field used to compare documentsclassFieldName
- the name of the field containing the class assigned to documentsanalyzer
- the analyzer used to tokenize / filter the unseen textIOException
- If there is a low-level I/O error.public ClassificationResult<BytesRef> assignClass(String inputDocument) throws IOException
assignClass
in interface Classifier<BytesRef>
inputDocument
- a String containing text to be classifiedClassificationResult
holding assigned class of type T
and scoreIOException
- If there is a low-level I/O error.Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.