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>> extends java.lang.Object implements IResultBuilder<T,S>
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
Modifier and Type | Field and Description |
---|---|
java.util.Map<MWEPOS,java.util.concurrent.atomic.AtomicInteger> |
answerData |
java.util.Map<MWEPOS,java.util.concurrent.atomic.AtomicInteger> |
correctData |
java.util.Map<java.lang.String,ISentenceResult<T,S>> |
details |
java.util.Map<MWEPOS,java.util.concurrent.atomic.AtomicInteger> |
foundData |
java.util.Map<MWEPOS,AtomicDouble<T,S>> |
partialScores |
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
void |
addDetail(java.lang.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 java.util.Map<MWEPOS,AtomicDouble<T,S>> |
initDoubleMap()
Provides a new, empty map for double values.
|
protected java.util.Map<MWEPOS,java.util.concurrent.atomic.AtomicInteger> |
initIntegerMap()
Provides a new map for integer values.
|
void |
process(java.util.List<IMWE<T>> found,
java.util.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 java.util.Map<MWEPOS,java.lang.Double> |
toDblMap(java.util.Map<MWEPOS,AtomicDouble<T,S>> map)
Converts a map of AtomicDoubles to a map of Doubles.
|
protected java.util.Map<MWEPOS,java.lang.Integer> |
toIntMap(java.util.Map<MWEPOS,java.util.concurrent.atomic.AtomicInteger> map)
Converts a map of AtomicIntegers to a map of Integers.
|
java.lang.String |
toString() |
public final java.util.Map<MWEPOS,java.util.concurrent.atomic.AtomicInteger> answerData
public final java.util.Map<MWEPOS,java.util.concurrent.atomic.AtomicInteger> foundData
public final java.util.Map<MWEPOS,java.util.concurrent.atomic.AtomicInteger> correctData
public final java.util.Map<MWEPOS,AtomicDouble<T extends IToken,S extends IMarkedSentence<T>>> partialScores
public final java.util.Map<java.lang.String,ISentenceResult<T extends IToken,S extends IMarkedSentence<T>>> details
public MWEResultBuilder()
public MWEResultBuilder(boolean captureDetails)
captureDetails
- the flag that if true
, means that this builder will store
results from each sentence.public void process(java.util.List<IMWE<T>> found, java.util.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(java.lang.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 java.util.Map<MWEPOS,java.lang.Integer> toIntMap(java.util.Map<MWEPOS,java.util.concurrent.atomic.AtomicInteger> map)
map
- the map to be convertedprotected java.util.Map<MWEPOS,java.lang.Double> toDblMap(java.util.Map<MWEPOS,AtomicDouble<T,S>> map)
map
- the map to be convertedpublic java.lang.String toString()
toString
in class java.lang.Object
protected java.util.Map<MWEPOS,java.util.concurrent.atomic.AtomicInteger> initIntegerMap()
protected java.util.Map<MWEPOS,AtomicDouble<T,S>> initDoubleMap()
Copyright © 2011 Massachusetts Institute of Technology. All Rights Reserved.