|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.mit.jmwe.harness.TestHarness
public class TestHarness
Runs an 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.
Constructor Summary | |
---|---|
protected |
TestHarness()
This constructor is marked protected so that this class may be subclassed, but not directly instantiated. |
Method Summary | ||
---|---|---|
static TestHarness |
getInstance()
Returns the singleton instance of this class, instantiating if necessary. |
|
|
run(IMWEDetector detector,
IResultBuilder<T,S> result,
Iterator<S> itr,
IAnswerKey answers,
IProgressBar pb)
Runs the detector in the test harness and stores the results in the provided result builder. |
|
|
run(Map<IMWEDetector,IResultBuilder<T,S>> detectors,
Iterator<S> itr,
IAnswerKey answers,
IProgressBar pb)
Runs the detectors in the test harness and stores the results in the associated result builder. |
|
protected
|
runDetector(IMWEDetector detector,
IResultBuilder<T,S> builder,
S sent,
List<IMWE<T>> answers)
Runs the detector over a single sentence, storing the result as an ISentenceResult in the given result builder. |
|
protected
|
runDetectors(Map<IMWEDetector,IResultBuilder<T,S>> detectors,
S sent,
List<IMWE<T>> answers)
Runs a set of detectors on the specified sentence, comparing the results to the specified answers. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected TestHarness()
Method Detail |
---|
public static TestHarness getInstance()
public <T extends IToken,S extends IMarkedSentence<T>> void run(IMWEDetector detector, IResultBuilder<T,S> result, 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(Map<IMWEDetector,IResultBuilder<T,S>> detectors, 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(Map<IMWEDetector,IResultBuilder<T,S>> detectors, S sent, 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 sentence
NullPointerException
- if any argument is null
protected <T extends IToken,S extends IMarkedSentence<T>> List<IMWE<T>> runDetector(IMWEDetector detector, IResultBuilder<T,S> builder, S sent, 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 sentence
NullPointerException
- if any argument is null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |