T - the token typeS - the sentence typepublic class SentenceResult<T extends IToken,S extends IMarkedSentence<T>> extends java.lang.Object implements ISentenceResult<T,S>
ISentenceResult interface.| Constructor and Description |
|---|
SentenceResult(java.util.List<IMWE<T>> answer,
java.util.List<IMWE<T>> retrieved,
S sentence)
Constructs a sentence result from a list of answer multi-word expressions
and a list of multi-word expressions found by the detector.
|
SentenceResult(java.util.List<IMWE<T>> answer,
java.util.List<IMWE<T>> retrieved,
S sentence,
boolean reallocate)
Constructs a sentence result from a list of answer multi-word expressions and
a list of multi-word expressions found by the detector.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.List<IMWE<T>> |
getAnswers()
Returns the answer multi-word expression in the sentence.
|
java.util.List<IMWE<T>> |
getFalseNegatives()
Returns a list of the false negatives.
|
java.util.List<IMWE<T>> |
getFalsePositives()
Returns a list of the false positives.
|
java.util.List<IMWE<T>> |
getFound()
Returns the multi-word expression found by the detector in the sentence.
|
double |
getFScore()
Returns the F1 score, a double between zero and 1, inclusive.
|
double |
getPrecision()
Returns the precision, a double between zero and 1, inclusive.
|
double |
getRecall()
Returns the recall, a double between zero and 1, inclusive.
|
S |
getSentence()
Returns the sentence corresponding to this result.
|
int |
getTotalAnswers()
Returns the total number of answers.
|
int |
getTotalCorrect()
Returns the total number of items correctly identified.
|
int |
getTotalFound()
Returns the total number items found.
|
java.util.List<IMWE<T>> |
getTruePositives()
Returns a list of the true positives.
|
static <T extends IToken,S extends IMarkedSentence<T>> |
printTable(java.lang.StringBuilder sb,
ISentenceResult<T,S> result,
java.util.Formatter f)
Prints a table of the correct, false negative and false positive
expressions found by the detector in columns.
|
java.lang.String |
toString() |
static <T extends IToken,S extends IMarkedSentence<T>> |
toString(ISentenceResult<T,S> result,
S sentence,
boolean table)
Creates a graphical representation of the multi-word expressions found by
the detector for a given sentence.
|
static <T extends IToken,U extends IMarkedSentence<T>> |
toString(ISentenceResult<T,U> result,
U sentence)
Creates a graphical representation of the multi-word expressions found by
the detector for a given sentence.
|
public SentenceResult(java.util.List<IMWE<T>> answer, java.util.List<IMWE<T>> retrieved, S sentence)
answer - a non-null list of answer multi-word expressions.retrieved - a non-null list of multi-word expressions found by the
detector.sentence - the sentence for which this object is a resultjava.lang.NullPointerException - if either list is nullpublic SentenceResult(java.util.List<IMWE<T>> answer, java.util.List<IMWE<T>> retrieved, S sentence, boolean reallocate)
answer - a non-null list of answer multi-word expressions.retrieved - a non-null list of multi-word expressions found by the
detector.sentence - the sentence for which this object is a resultreallocate - If true, will allocate new internal lists for the answer and
retrieved lists.java.lang.NullPointerException - if either list is nullpublic S getSentence()
ISentenceResultgetSentence in interface ISentenceResult<T extends IToken,S extends IMarkedSentence<T>>public java.util.List<IMWE<T>> getFalseNegatives()
ISentenceResultnull.getFalseNegatives in interface ISentenceResult<T extends IToken,S extends IMarkedSentence<T>>null.public java.util.List<IMWE<T>> getFalsePositives()
ISentenceResultnull.getFalsePositives in interface ISentenceResult<T extends IToken,S extends IMarkedSentence<T>>null.public java.util.List<IMWE<T>> getTruePositives()
ISentenceResultnull.getTruePositives in interface ISentenceResult<T extends IToken,S extends IMarkedSentence<T>>null.public java.util.List<IMWE<T>> getAnswers()
ISentenceResultnull.getAnswers in interface ISentenceResult<T extends IToken,S extends IMarkedSentence<T>>null.public java.util.List<IMWE<T>> getFound()
ISentenceResultnull.getFound in interface ISentenceResult<T extends IToken,S extends IMarkedSentence<T>>null.public double getPrecision()
IBaseResultgetPrecision in interface IBaseResultpublic double getRecall()
IBaseResultgetRecall in interface IBaseResultpublic double getFScore()
IBaseResultgetFScore in interface IBaseResultpublic int getTotalAnswers()
IBaseResultgetTotalAnswers in interface IBaseResultpublic int getTotalCorrect()
IBaseResultgetTotalCorrect in interface IBaseResultpublic int getTotalFound()
IBaseResultgetTotalFound in interface IBaseResultpublic java.lang.String toString()
toString in class java.lang.Objectpublic static <T extends IToken,U extends IMarkedSentence<T>> java.lang.String toString(ISentenceResult<T,U> result, U sentence)
T - the type of tokens in the sentence and its associated multi-word
expressionsU - the type of sentence. Is parameterized by tokens of type T.result - the sentence result obtained after running the detector over the
sentencesentence - the sentence the detector is run overpublic static <T extends IToken,S extends IMarkedSentence<T>> java.lang.String toString(ISentenceResult<T,S> result, S sentence, boolean table)
T - the type of tokens in the sentence and its associated multi-word
expressionsS - the type of sentence. Is parameterized by tokens of type T.result - the sentence result obtained after running the detector over the
sentencesentence - the sentence the detector is run overtable - if true, prints the correct, false negative, and false
positive expressions in columns under the sentence.public static <T extends IToken,S extends IMarkedSentence<T>> void printTable(java.lang.StringBuilder sb, ISentenceResult<T,S> result, java.util.Formatter f)
T - the type of tokens in the sentence and its associated
multi-word expressionsS - the type of sentence. Is parameterized by tokens of type T.sb - the string builder to which the table should be writtenresult - the result to be writtenf - the formatter to be usedCopyright © 2011 Massachusetts Institute of Technology. All Rights Reserved.