|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.fu_berlin.ties.io.BaseStorable
de.fu_berlin.ties.classify.Prediction
de.fu_berlin.ties.extract.Extraction
Extends a Prediction
by also storing the
extracted text and location data.
Instances of this class are not thread-safe and cannot handle extraction from several documents in parallel.
Field Summary | |
static String |
KEY_FIRST_TOKEN_REP
Serialization key for the repetition of the first token. |
static String |
KEY_TEXT
Serialization key for the extracted text. |
Fields inherited from class de.fu_berlin.ties.classify.Prediction |
KEY_PR, KEY_PROB, KEY_SOURCE, KEY_TYPE |
Constructor Summary | |
Extraction(FieldMap fieldMap)
Creates a new instance from a field map, fulfilling the Storable contract. |
|
Extraction(String predicted,
double prob,
double pr,
String extracted,
int ftRep)
Creates a new instance, setting the evaluation status to EvalStatus.UNKNOWN . |
|
Extraction(String predicted,
double prob,
double pr,
String extracted,
int ftRep,
EvalStatus status)
Creates a new instance. |
|
Extraction(String predicted,
String extracted,
int ftRep)
Creates a new instance, setting the probability to -1 ("confirmed") and the evaluation status to EvalStatus.TRUTH .
|
Method Summary | |
void |
append(String newText,
boolean afterWhitespace)
Appends text to this extraction, using a new probability of -1 ("confirmed"). |
void |
append(String newText,
boolean afterWhitespace,
double newProb,
double newPR)
Appends text to this extraction, recalculating the probability by multiplying the prior probability value with the probability of the new text. |
boolean |
equals(Object obj)
Indicates whether some other object is "equal to" this one, fulfulling the Object.equals(java.lang.Object) contract. |
int |
getFirstTokenRep()
Returns the repetition of the first token of the extraction in the original text (counting starts with 0, as the first occurrence is the "0th repetition"), -1 if unknown. |
String |
getText()
Returns the extracted text fragment. |
String |
getVisibleChars()
Returns The visible characters of the text fragment (everything except whitespace and control characters). |
int |
hashCode()
Returns a hash code value for this object, fulfulling the Object.hashCode() contract. |
boolean |
isSealed()
Whether this extraction has been sealed . |
void |
seal()
Seals this extraction. |
void |
setFirstTokenRep(int newFirstTokenRep)
Modifies the repetition of the first token of the extraction in the original text (counting starts with 0, as the first occurrence is the "0th repetition"); or -1 if unknown/irrelevant. |
FieldMap |
storeFields()
Stores all relevant fields of this object in a field map for serialization. |
Methods inherited from class de.fu_berlin.ties.classify.Prediction |
addProb, getEvalStatus, getPR, getProbability, getSource, getType, setEvalStatus, setSource |
Methods inherited from class de.fu_berlin.ties.io.BaseStorable |
toString, toString |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface de.fu_berlin.ties.context.Recognition |
getType |
Field Detail |
public static final String KEY_TEXT
public static final String KEY_FIRST_TOKEN_REP
Constructor Detail |
public Extraction(FieldMap fieldMap)
Storable
contract. An extraction created
this way will be immediately sealed
, thus the extracted
text cannot be changed.
fieldMap
- map containing the serialized fieldspublic Extraction(String predicted, String extracted, int ftRep)
EvalStatus.TRUTH
.
Use this constructor to build answer keys.
predicted
- the predicted classextracted
- the (first part) extracted text fragment; must not be
null
ftRep
- the repetition of the first token in the text (counting
starts with 0, as the first occurrence is the "0th repetition"); -1 if
unknownpublic Extraction(String predicted, double prob, double pr, String extracted, int ftRep)
EvalStatus.UNKNOWN
.
predicted
- the predicted classprob
- the probability of the prediction (must be in the range from
0.0 to 1.0, or -1 if this is a confirmed extraction resp. an answer key)pr
- the pR of the prediction;
or Double.NaN
if not knownextracted
- the (first part) extracted text fragment; must not be
null
ftRep
- the repetition of the first token in the text (counting
starts with 0, as the first occurrence is the "0th repetition"); -1 if
unknownpublic Extraction(String predicted, double prob, double pr, String extracted, int ftRep, EvalStatus status)
predicted
- the predicted classprob
- the probability of the prediction (must be in the range from
0.0 to 1.0, or -1 if this is a confirmed extraction resp. an answer key)pr
- the pR of the prediction;
or Double.NaN
if not knownextracted
- the (first part) extracted text fragment; must not be
null
ftRep
- the repetition of the first token in the text (counting
starts with 0, as the first occurrence is the "0th repetition"); -1 if
unknownstatus
- the evaluation status of this
instanceMethod Detail |
public void append(String newText, boolean afterWhitespace) throws IllegalStateException
newText
- the text to append to the extracted text fragmentafterWhitespace
- whether the add a space character before the
new text
IllegalStateException
- if this extraction
is sealed
public void append(String newText, boolean afterWhitespace, double newProb, double newPR) throws IllegalStateException
newText
- the text to append to the extracted text fragmentafterWhitespace
- whether the add a space character before the
new textnewProb
- the probability of the new text; or -1
if this is an answer keynewPR
- the new pR; or Double.NaN
if not used
IllegalStateException
- if this extraction
is sealed
; or if new and old probabilities/pRs
cannot be combinedpublic boolean equals(Object obj)
Object.equals(java.lang.Object)
contract. The
evaluation status is ignored when
checking equality, thus if all other fields of two extractions are equal,
this method will return true
even if their evaluation states
differ. Only the visible characters
of the
extractions are compared, whitespace and control characters are ignored.
equals
in class Prediction
obj
- the reference object with which to compare
true
iff the specified object is an
Extraction
equal to this instancepublic int getFirstTokenRep()
public String getText()
getText
in interface Recognition
public String getVisibleChars()
public int hashCode()
Object.hashCode()
contract.
hashCode
in class Prediction
public boolean isSealed()
sealed
. The text of a
sealed extraction cannot longer be changed. This means that
appending is not allowed after
sealing.
isSealed
in interface Recognition
true
iff this extraction is sealedpublic void seal()
public void setFirstTokenRep(int newFirstTokenRep)
newFirstTokenRep
- the new value of the attributepublic FieldMap storeFields()
FieldMap.createObject(Class)
on the created
field map.
storeFields
in interface Storable
storeFields
in class Prediction
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |