Class HmmEvaluator

  extended by com.aliasi.hmm.HmmEvaluator
All Implemented Interfaces:
Handler, TagHandler

Deprecated. Use TaggerEvaluator, MarginalTaggerEvaluator and NBestTaggerEvaluator instead.

public class HmmEvaluator
extends Object
implements TagHandler

An HmmEvaluator provides an evaluation mechanism for HMMs. An evaluator is constructed with an HMM, the array of tags used, and a limit on how far the n-best list is searched. It implements the TagHandler interface, which specifies the handle(String[],String[],String[]) method. This method will receive reference taggins in the form of arrays of tokens, whitespaces (which are ignored), and a reference tagging. It then runs an HMM decoder based on the specified HMM over the input to produce responses in the form of a first-best response, a confidence-based lattice response and an n-best iterator response. At any point in the sequence of test cases, the evaluation returned by evaluation() may be inspected.

Bob Carpenter

Constructor Summary
HmmEvaluator(HiddenMarkovModel hmm, String[] tags, int nBest)
HmmEvaluator(HmmDecoder decoder, HmmEvaluation evaluation)
          Deprecated. See the class documentation.
Method Summary
 HmmEvaluation evaluation()
          Deprecated. See the class doc.
 void handle(String[] tokens, String[] whitespaces, String[] referenceTags)
          Deprecated. Handle the specified tokens and reference tags as a test case, ignoring the whitespaces value.
 String lastCaseToString()
          Deprecated. Return a string-based representation of the results for the last case handled by this evaluator.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public HmmEvaluator(HiddenMarkovModel hmm,
                               String[] tags,
                               int nBest)

Construct a scorer for hidden Markov model taggings from the specified HMM.

hmm - Hidden Markov model to use for tagging.
tags - Array of outcome tags in the specified model.
nBest - Maximum number of n-best results to evaluate per case.


public HmmEvaluator(HmmDecoder decoder,
                               HmmEvaluation evaluation)
Deprecated. See the class documentation.

Construct an evaluator for the specified hidden Markov model decoder and specified evaluation.

Method Detail


public void handle(String[] tokens,
                   String[] whitespaces,
                   String[] referenceTags)
Handle the specified tokens and reference tags as a test case, ignoring the whitespaces value. The whitespaces value may be null. For each call to this method, the HMM being evaluated will be run over the tokens to produce first-best, lattice and n-best outputs, which are then used to populate an HMM evaluation.

Specified by:
handle in interface TagHandler
tokens - Tokens for evaluation.
whitespaces - Ignored.
referenceTags - Reference tags for evaluation.
IllegalArgumentException - If the token and tag arrays are not the same length; whitespaces are not checked.


public String lastCaseToString()
Return a string-based representation of the results for the last case handled by this evaluator. The report contains information on the tokenization and reference tags, first-best tags, n-best rank and an extensive dump of confidences for indivdiual tags.

Note that cumulative results are available from the HMM evaluation returned by evaluation().

A string-based representation of the last case handled by this evaluator.


public HmmEvaluation evaluation()
Deprecated. See the class doc.

Returns the evaluation produced by this evaluator. This evaluation may be inspected at any time. The returned evaluation is the same evaluation contained in the evaluator, so any changes to it will affect this evaluator.

The evaluation for this evaluator.