public class TestHarness extends java.lang.Object implements ITestHarness
IMWEDetector
over a corpus and compares the
multi-word expressions the detector finds to the multi-word expressions found
in the answer key. Stores results of the runs in a result builder.Modifier | Constructor and Description |
---|---|
protected |
TestHarness()
This constructor is marked protected so that this class may be
subclassed, but not directly instantiated.
|
Modifier and Type | Method and Description |
---|---|
static TestHarness |
getInstance()
Returns the singleton instance of this class, instantiating if necessary.
|
<T extends IToken,S extends IMarkedSentence<T>> |
run(IMWEDetector detector,
IResultBuilder<T,S> result,
java.util.Iterator<S> itr,
IAnswerKey answers,
IProgressBar pb)
Runs the detector in the test harness and stores the results in the
provided result builder.
|
<T extends IToken,S extends IMarkedSentence<T>> |
run(java.util.Map<IMWEDetector,IResultBuilder<T,S>> detectors,
java.util.Iterator<S> itr,
IAnswerKey answers,
IProgressBar pb)
Runs the detectors in the test harness and stores the results in the
associated result builder.
|
protected <T extends IToken,S extends IMarkedSentence<T>> |
runDetector(IMWEDetector detector,
IResultBuilder<T,S> builder,
S sent,
java.util.List<IMWE<T>> answers)
Runs the detector over a single sentence, storing the result as an
ISentenceResult in the given result builder. |
protected <T extends IToken,S extends IMarkedSentence<T>> |
runDetectors(java.util.Map<IMWEDetector,IResultBuilder<T,S>> detectors,
S sent,
java.util.List<IMWE<T>> answers)
Runs a set of detectors on the specified sentence, comparing the results
to the specified answers.
|
protected TestHarness()
public static TestHarness getInstance()
public <T extends IToken,S extends IMarkedSentence<T>> void run(IMWEDetector detector, IResultBuilder<T,S> result, java.util.Iterator<S> itr, IAnswerKey answers, IProgressBar pb)
ITestHarness
run
in interface ITestHarness
T
- the type of tokens in the IMarkedSentence
objects the
harness runs overS
- the type of unit the harness runs over. Is parameterized by
tokens of type T.detector
- the detector being tested. May not be null
result
- the builder in which the results should be stored; may not be
null
itr
- an iterator over the units the detector will be tested on. May
not be null
.answers
- an answer key that can be used to find the answer multi-word
expressions in a unit. May not be null
.pb
- a progress bar to which the harness should report progress.
May be null
public <T extends IToken,S extends IMarkedSentence<T>> void run(java.util.Map<IMWEDetector,IResultBuilder<T,S>> detectors, java.util.Iterator<S> itr, IAnswerKey answers, IProgressBar pb)
ITestHarness
run
in interface ITestHarness
T
- the type of tokens in the IMarkedSentence
objects the
harness runs overS
- the type of unit the harness runs over. Is parameterized by
tokens of type T.detectors
- the detector-to-builder map being tested. May not be
null
itr
- an iterator over the units the detector will be tested on. May
not be null
.answers
- an answer key that can be used to find the answer multi-word
expressions in a unit. May not be null
.pb
- a progress bar to which the harness should report progress.
May be null
protected <T extends IToken,S extends IMarkedSentence<T>> void runDetectors(java.util.Map<IMWEDetector,IResultBuilder<T,S>> detectors, S sent, java.util.List<IMWE<T>> answers)
T
- the token typeS
- the sentence typedetectors
- the detector-to-builder mapsent
- the sentence on which the detectors should be runanswers
- the set of answers for the sentencejava.lang.NullPointerException
- if any argument is null
protected <T extends IToken,S extends IMarkedSentence<T>> java.util.List<IMWE<T>> runDetector(IMWEDetector detector, IResultBuilder<T,S> builder, S sent, java.util.List<IMWE<T>> answers)
ISentenceResult
in the given result builder.T
- the type of tokens in the sentenceS
- the type of sentencedetector
- the detector to be testedbuilder
- the result builder being used to store the results of the test
harnesssent
- the sentence the detector will be run overanswers
- the list of answer MWEs in the sentencejava.lang.NullPointerException
- if any argument is null
Copyright © 2011 Massachusetts Institute of Technology. All Rights Reserved.