|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.mit.jmwe.harness.result.MWEResultBuilder<T,S>
T
- the type of tokens contained in the unit and its associated
multi-word expressions.S
- the type of unit whose results are stored. Is parameterized by
tokens of type T.public class MWEResultBuilder<T extends IToken,S extends IMarkedSentence<T>>
Builds an MWEResult
by processing the data in ISentenceResult
objects. Calculates the overall precision and recall scores with and without
partial credit. All of the data stored in this builder is organized by part
of speech.
Partial credit is given when the detector correctly identifies some but not
all of the tokens in an expression or if it includes some extra incorrect
tokens in the expression. The partial credit is the alignment score between a
partially correct MWE and an answer MWE. This alignment score is the ratio of
the number of tokens shared between the two MWEs and the total number of
unique tokens in both MWEs. It will be somewhere in between 0 (not
overlapping at all) and 1 (overlapping perfectly). For example, in
Senator Ben Cardin of Maryland voted for the health insurance bill.If the detector correctly identifies health insurance but identifies Senator Ben Cardin of Maryland instead of Senator Ben Cardin, the scores would be
Found Actual Correct pc Pr Re Pr/pc Re/pc ---------------------------------------------------------- 2 2 1 0.6 0.5 0.5 0.8 0.8
Field Summary | |
---|---|
Map<MWEPOS,AtomicInteger> |
answerData
|
Map<MWEPOS,AtomicInteger> |
correctData
|
Map<String,ISentenceResult<T,S>> |
details
|
Map<MWEPOS,AtomicInteger> |
foundData
|
Map<MWEPOS,AtomicDouble<T,S>> |
partialScores
|
Constructor Summary | |
---|---|
MWEResultBuilder()
Constructs a new builder that stores the detailed results obtained from individual sentences. |
|
MWEResultBuilder(boolean captureDetails)
Constructs a new builder that, if the captureDetials flag is true, will stores the detailed results obtained from individual sentences. |
Method Summary | |
---|---|
void |
addDetail(String ID,
ISentenceResult<T,S> detail)
Stores the results for a unit under its ID. |
MWEResult<T,S> |
createResult()
Creates a result from the data stored in this builder. |
protected Map<MWEPOS,AtomicDouble<T,S>> |
initDoubleMap()
Provides a new, empty map for double values. |
protected Map<MWEPOS,AtomicInteger> |
initIntegerMap()
Provides a new map for integer values. |
void |
process(List<IMWE<T>> found,
List<IMWE<T>> answers)
Updates the internal data stored in this builder by comparing the multi-word expressions found by an MWE detector to the answer multi-word expressions. |
protected Map<MWEPOS,Double> |
toDblMap(Map<MWEPOS,AtomicDouble<T,S>> map)
Converts a map of AtomicDoubles to a map of Doubles. |
protected Map<MWEPOS,Integer> |
toIntMap(Map<MWEPOS,AtomicInteger> map)
Converts a map of AtomicIntegers to a map of Integers. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public final Map<MWEPOS,AtomicInteger> answerData
public final Map<MWEPOS,AtomicInteger> foundData
public final Map<MWEPOS,AtomicInteger> correctData
public final Map<MWEPOS,AtomicDouble<T extends IToken,S extends IMarkedSentence<T>>> partialScores
public final Map<String,ISentenceResult<T extends IToken,S extends IMarkedSentence<T>>> details
Constructor Detail |
---|
public MWEResultBuilder()
public MWEResultBuilder(boolean captureDetails)
captureDetails
- the flag that if true
, means that this builder will store
results from each sentence.Method Detail |
---|
public void process(List<IMWE<T>> found, List<IMWE<T>> answers)
IResultBuilder
process
in interface IResultBuilder<T extends IToken,S extends IMarkedSentence<T>>
found
- A non-null list of multi-word expressions found by an
IMWEDetector.answers
- A non-null list of answer multi-word expressionspublic void addDetail(String ID, ISentenceResult<T,S> detail)
IResultBuilder
addDetail
in interface IResultBuilder<T extends IToken,S extends IMarkedSentence<T>>
ID
- the non-null identification String for the unitdetail
- the unit result. May not be null
.public MWEResult<T,S> createResult()
IResultBuilder
null
.
createResult
in interface IResultBuilder<T extends IToken,S extends IMarkedSentence<T>>
protected Map<MWEPOS,Integer> toIntMap(Map<MWEPOS,AtomicInteger> map)
map
- the map to be converted
protected Map<MWEPOS,Double> toDblMap(Map<MWEPOS,AtomicDouble<T,S>> map)
map
- the map to be converted
public String toString()
toString
in class Object
protected Map<MWEPOS,AtomicInteger> initIntegerMap()
protected Map<MWEPOS,AtomicDouble<T,S>> initDoubleMap()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |