Class AttachmentScores

java.lang.Object
opennlp.tools.depparse.AttachmentScores

final class AttachmentScores extends Object
Accumulates the unlabeled and labeled attachment scores over all tokens and over the tokens that are not punctuation. DependencyEvaluator adds single tokens and DependencyCrossValidator merges the totals of each fold.

Instances are not thread safe.

Since:
3.0.0
  • Field Details

    • uas

      private final Mean uas
    • las

      private final Mean las
    • uasExcludingPunctuation

      private final Mean uasExcludingPunctuation
    • lasExcludingPunctuation

      private final Mean lasExcludingPunctuation
  • Constructor Details

    • AttachmentScores

      AttachmentScores()
  • Method Details

    • add

      void add(boolean headMatches, boolean labelMatches, boolean punctuation)
      Adds the outcome of one token.
      Parameters:
      headMatches - Whether the predicted head equals the gold head.
      labelMatches - Whether the predicted head and relation both equal the gold ones.
      punctuation - Whether the token is punctuation and therefore left out of the punctuation-free scores.
    • add

      void add(AttachmentScores other)
      Adds every token counted by another accumulator, weighted by its token counts.
      Parameters:
      other - The accumulator to merge. Must not be null.
    • getUas

      double getUas()
      Returns:
      The unlabeled attachment score over all tokens, or 0 if none.
    • getLas

      double getLas()
      Returns:
      The labeled attachment score over all tokens, or 0 if none.
    • getWordCount

      long getWordCount()
      Returns:
      The number of tokens added.
    • getUasExcludingPunctuation

      double getUasExcludingPunctuation()
      Returns:
      The unlabeled attachment score over the tokens that are not punctuation, or 0 if none.
    • getLasExcludingPunctuation

      double getLasExcludingPunctuation()
      Returns:
      The labeled attachment score over the tokens that are not punctuation, or 0 if none.
    • getWordCountExcludingPunctuation

      long getWordCountExcludingPunctuation()
      Returns:
      The number of tokens added that are not punctuation.