|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.lucene.classification.SimpleNaiveBayesClassifier
public class SimpleNaiveBayesClassifier
A simplistic Lucene based NaiveBayes classifier, see http://en.wikipedia.org/wiki/Naive_Bayes_classifier
| Constructor Summary | |
|---|---|
SimpleNaiveBayesClassifier()
Creates a new NaiveBayes classifier. |
|
| Method Summary | |
|---|---|
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 |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SimpleNaiveBayesClassifier()
train() before you can
classify any documents.
| Method Detail |
|---|
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 text
IOException - 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 classified
ClassificationResult holding assigned class of type T and score
IOException - If there is a low-level I/O error.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||