Search code examples
solrluceneclassificationnaivebayes

How to get category name of lucene's SimpleNaiveBayesClassifier?


When using lucene's SimpleNaiveBayesClassifier the SimpleNaiveBayesClassifier#assignClass method returns an ClassificationResult<BytesRef>, how can I get the original value of category field?


Solution

  • This is what you want:

    classificationResult.getAssignedClass().utf8ToString()