public class ChunkerEvaluator extends Object implements ObjectHandler<Chunking>
ChunkerEvaulator class provides an evaluation
framework for chunkers. An instance of this class is constructed
based on the chunker to be evaluated. This class implements the
ObjectHandler<Chunking> interface in order to receive reference
chunkings. Reference chunkings may be added directly using the
handle(Chunking) or by passing this handler to an
appropriate parser. Either way, the sequence is extracted from the
reference chunking, the contained chunker is used to generate
a response chunking, and then the reference and response chunkings
are added to a contained ChunkingEvaluation which maintains
a running score. The method evaluation() returns the
contained chunking evaluation, which may be inspected for partial
results at any time.
| Constructor and Description |
|---|
ChunkerEvaluator(Chunker chunker)
Construct an evaluator for the specified chunker.
|
| Modifier and Type | Method and Description |
|---|---|
Chunker |
chunker()
Returns the underlying chunker for this evaluator.
|
ScoredPrecisionRecallEvaluation |
confidenceEvaluation()
Returns the scored precision-recall evaluation derived from a
confidence-based chunker.
|
ChunkingEvaluation |
evaluation()
Return the first-best chunking evaluation.
|
void |
handle(Chunking referenceChunking)
Handle the specified reference chunking.
|
String |
lastConfidenceCaseReport()
Returns a string-based representation of the last evaluation
case's confidence evaluation.
|
String |
lastFirstBestCaseReport()
Returns a string-based representation of the last evaluation
case and the first-best result.
|
String |
lastNBestCaseReport()
Returns a string-based representation of the last n-best
evaluation case.
|
ObjectToCounterMap<Integer> |
nBestEvaluation()
Returns the n-best evaluation in the form of a mapping from
ranks to the number of times the reference chunking was that
rank in the evaluation.
|
void |
setChunker(Chunker chunker)
Set the underlying chunker to the specified value.
|
void |
setMaxConfidenceChunks(int n)
Sets the maximum number of chunks extracted by a
confidence-based chunker for evaluation.
|
void |
setMaxNBest(int n)
Sets the maximum number of chunkings extracted by an n-best
chunker for evaluation.
|
void |
setMaxNBestReport(int n)
Sets the maximum number of chunkings that will be reported in a
case report.
|
void |
setVerbose(boolean isVerbose)
Sets the verbosity level of this evaluator to the specified
value.
|
String |
toString()
Returns a string-based representation of this evaluation.
|
public ChunkerEvaluator(Chunker chunker)
chunker - Chunker to evaluate.public Chunker chunker()
public void setChunker(Chunker chunker)
chunker - New underlying chunker for this evaluator.public void setVerbose(boolean isVerbose)
true, calls to handle(Chunking) will print (to System.out) a report
for each chunking evaluation (first-best, n-best and
confidence).
The reports that are written are also available as strings
programmatically through the methods lastNBestCaseReport(), and
lastConfidenceCaseReport(),
isVerbose - true for standard output per
case.public String lastFirstBestCaseReport()
public void setMaxConfidenceChunks(int n)
n - Number of chunks to extract with confidence.public String lastConfidenceCaseReport()
null.public void setMaxNBest(int n)
n - Number of chunkings to evaluate in n-best chunking.public void setMaxNBestReport(int n)
lastNBestCaseReport() method.n - Number of n-best results to print in a case report.public String lastNBestCaseReport()
public void handle(Chunking referenceChunking)
If the contained chunker returns null for
a given input, this method will fill in a chunking over
the appropriate sequence with no chunks for evaluation.
handle in interface ObjectHandler<Chunking>referenceChunking - The reference chunking case.public ScoredPrecisionRecallEvaluation confidenceEvaluation()
This is the actual evaluation used by this class, so changing it will affect this class's results.
public ChunkingEvaluation evaluation()
This is the actual evaluation used by this class, so changing it will affect this class's results.
public ObjectToCounterMap<Integer> nBestEvaluation()
Integer, with -1 being the rank
assigned to cases in which the reference chunking was not
among the n-best results.
This is the actual counter used by this class, so changing it will affect this class's results.
If the chunker being evaluated is not an n-best chunker, then this evaluation will be empty.
public String toString()
Copyright © 2016 Alias-i, Inc.. All rights reserved.