Class LemmatizerEvaluator

java.lang.Object
opennlp.tools.util.eval.Evaluator<LemmaSample>
opennlp.tools.lemmatizer.LemmatizerEvaluator

public class LemmatizerEvaluator extends Evaluator<LemmaSample>
The LemmatizerEvaluator measures the performance of the given Lemmatizer with the provided reference samples.
  • Field Details

    • lemmatizer

      private final Lemmatizer lemmatizer
    • wordAccuracy

      private final Mean wordAccuracy
  • Constructor Details

  • Method Details

    • processSample

      protected LemmaSample processSample(LemmaSample reference)
      Evaluates the given reference LemmaSample object.

      This is done by tagging the sentence from the reference LemmaSample with the Lemmatizer. The tags are then used to update the word accuracy score.

      Specified by:
      processSample in class Evaluator<LemmaSample>
      Parameters:
      reference - the reference LemmaSample.
      Returns:
      The predicted LemmaSample.
    • getWordAccuracy

      public double getWordAccuracy()
      Accuracy is defined as: word accuracy = correctly detected tags / total words
      Returns:
      Retrieves the word accuracy.
    • getWordCount

      public long getWordCount()
      Returns:
      Retrieves the total number of words considered in the evaluation.
    • toString

      public String toString()
      Returns this object's human-readable String representation.
      Overrides:
      toString in class Object