Class EvaluationErrorPrinter<T>

java.lang.Object
opennlp.tools.cmdline.EvaluationErrorPrinter<T>
All Implemented Interfaces:
EvaluationMonitor<T>
Direct Known Subclasses:
ChunkEvaluationErrorListener, DetokenEvaluationErrorListener, DoccatEvaluationErrorListener, LanguageDetectorEvaluationErrorListener, LemmaEvaluationErrorListener, NameEvaluationErrorListener, POSEvaluationErrorListener, SentenceEvaluationErrorListener, TokenEvaluationErrorListener

@Internal public abstract class EvaluationErrorPrinter<T> extends Object implements EvaluationMonitor<T>
Note: Do not use this class, internal use only!
  • Field Details

  • Constructor Details

    • EvaluationErrorPrinter

      protected EvaluationErrorPrinter(OutputStream outputStream)
    • EvaluationErrorPrinter

      protected EvaluationErrorPrinter(PrintStream printStream)
  • Method Details

    • printError

      protected void printError(Span[] references, Span[] predictions, T referenceSample, T predictedSample, String sentence)
    • printError

      protected void printError(String id, Span[] references, Span[] predictions, T referenceSample, T predictedSample, String[] sentenceTokens)
    • printError

      protected void printError(Span[] references, Span[] predictions, T referenceSample, T predictedSample, String[] sentenceTokens)
    • printError

      protected void printError(String[] references, String[] predictions, T referenceSample, T predictedSample, String[] sentenceTokens)
    • printError

      protected void printError(T referenceSample, T predictedSample)
    • printErrors

      private void printErrors(List<String> filteredDoc, List<String> filteredRefs, List<String> filteredPreds)
      Auxiliary method to print tag errors
      Parameters:
      filteredDoc - the document tokens which were tagged wrong
      filteredRefs - the reference tags
      filteredPreds - the predicted tags
    • printErrors

      private void printErrors(List<Span> falsePositives, List<Span> falseNegatives, String doc)
      Auxiliary method to print span errors
      Parameters:
      falsePositives - false positives span
      falseNegatives - false negative span
      doc - the document text
    • printErrors

      private void printErrors(List<Span> falsePositives, List<Span> falseNegatives, String[] toks)
      Auxiliary method to print span errors
      Parameters:
      falsePositives - false positives span
      falseNegatives - false negative span
      toks - the document tokens
    • print

      private String print(List<Span> spans, String[] toks)
      Auxiliary method to print spans
      Parameters:
      spans - the span list
      toks - the tokens array
      Returns:
      the spans as string
    • printSamples

      private <S> void printSamples(S referenceSample, S predictedSample)
      Auxiliary method to print expected and predicted samples.
      Parameters:
      referenceSample - The S from the references.
      predictedSample - The S of the predictions.
    • findErrors

      private void findErrors(Span[] references, Span[] predictions, List<Span> falseNegatives, List<Span> falsePositives)
      Outputs falseNegatives and falsePositives spans from the references and predictions list.
      Parameters:
      references - The spans from the references.
      predictions - The spans of the predictions.
      falseNegatives - The false negatives list.
      falsePositives - The false positives list.
    • correctlyClassified

      public void correctlyClassified(T reference, T prediction)
      Specified by:
      correctlyClassified in interface EvaluationMonitor<T>
    • misclassified

      public abstract void misclassified(T reference, T prediction)
      Specified by:
      misclassified in interface EvaluationMonitor<T>