|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectinfo.ephyra.search.Result
public class Result
A Result is a data structure representing a result returned
by the QA engine.
It comprises the following elements:
This class implements the interfaces Comparable and
Serializable. Note: it has a natural ordering that is
inconsistent with equals().
| Field Summary | |
|---|---|
private java.lang.String |
answer
The answer string. |
private java.lang.String |
cacheID
The ID of the document in the search engine cache (optional). |
private boolean |
correct
A flag indicating whether the answer was judged correct (optional). |
private java.util.ArrayList<java.lang.String> |
coveredNuggets
If this is an answer to an 'other' question, list to keep the IDs of covered nugget (optional). |
private java.lang.String |
docID
The ID (e.g. a URL) of a document containing the answer (optional). |
private java.lang.String[] |
extractionTechniques
If this is a factoid answer, the techniques used to extract it (optional). |
private java.util.HashMap<java.lang.String,java.lang.Float> |
extraScores
Hashmap holding intermediate scores so they don't influence sorting |
private int |
hitPos
The hit position of the answer, starting from 0 (optional). |
private java.util.Map<java.lang.String,java.lang.String[]> |
nes
If this is a sentence-level answer, named entities extracted from the sentence and their types (optional). |
private java.lang.String[] |
neTypes
If this is a factoid answer, the named entity types (optional). |
private float |
normScore
A normalized confidence measure for the answer (optional). |
private Predicate |
predicate
If this is a sentence-level answer, a predicate extracted from the sentence (optional). |
private Query |
query
The Query that was used to obtain the answer (optional). |
private float |
score
A confidence measure for the answer, initially 0. |
private java.lang.String |
sentence
If this is a factoid answer, a sentence in the supporting document the answer was extracted from (optional). |
private static long |
serialVersionUID
Version number used during deserialization. |
private Term[] |
terms
If this is a sentence-level answer, terms extracted from the sentence (optional). |
| Constructor Summary | |
|---|---|
Result(java.lang.String answer)
Creates a Result object and sets the answer string. |
|
Result(java.lang.String answer,
Query query)
Creates a Result object and sets the answer string and the
Query that was used to obtain the answer. |
|
Result(java.lang.String answer,
Query query,
java.lang.String docID)
Creates a Result object and sets the answer string, the
Query that was used to obtain the answer and the ID of a
document that contains it. |
|
Result(java.lang.String answer,
Query query,
java.lang.String docID,
int hitPos)
Creates a Result object and sets the answer string, the
Query that was used to obtain the answer, the ID of a
document that contains it and the hit position. |
|
| Method Summary | |
|---|---|
void |
addCoveredNuggetID(java.lang.String nuggetID)
Adds the ID of a nugget covered by an answer to an 'other' question. |
boolean |
addExtractionTechnique(java.lang.String technique)
Adds an answer extraction technique for a factoid answer. |
void |
addExtraScore(java.lang.String sourceName,
float score)
add an extra score to this Result for storage, extra score will not influence sorting |
boolean |
addNeType(java.lang.String neType)
Adds a named entity type for a factoid answer. |
int |
compareTo(Result result)
Compares two results by comparing their scores. |
boolean |
equals(java.lang.Object o)
Indicates whether an other result is equal to this one. |
boolean |
extractedWith(java.lang.String technique)
Checks if a factoid answer was extracted with the given technique. |
java.lang.String |
getAnswer()
Returns the answer string. |
java.lang.String |
getCacheID()
Returns the ID of the document in the search engine cache or null if it is not set. |
Result |
getCopy()
Returns a copy of this Result object. |
java.lang.String[] |
getCoveredNuggetIDs()
Returns the IDs of all nuggets covered by an answer to an 'other' question. |
java.lang.String |
getDocID()
Returns the ID of a document that contains the answer or null if it is not set. |
java.lang.String[] |
getExtractionTechniques()
Returns the techniques a factoid answer was extracted with. |
float |
getExtraScore(java.lang.String sourceName)
retrieve the extra score set by some source |
float[] |
getExtraScores()
retrieve all extra scores set for this Result |
int |
getHitPos()
Returns the hit position of the result, starting from 0, or -1 if it is not set. |
java.util.Map<java.lang.String,java.lang.String[]> |
getNes()
Returns named entities extracted from a sentence-level answer and their types. |
java.lang.String[] |
getNeTypes()
Gets the named entity types if the answer is a named entity. |
float |
getNormScore()
Returns the normalized score of the result. |
Predicate |
getPredicate()
Returns a predicate extracted from a sentence-level answer. |
Query |
getQuery()
Returns the Query that was used to obtain this result, or
null if it is not set. |
float |
getScore()
Returns the confidence score of the result. |
java.lang.String |
getSentence()
Returns the supporting sentence of a factoid answer. |
Term[] |
getTerms()
Returns terms extracted from a sentence-level answer. |
int |
hashCode()
Returns the hash code of the answer string as a hash code for the result. |
void |
incScore(float value)
Increments the confidence score by the given value. |
boolean |
isCorrect()
Checks if the answer was judged correct. |
boolean |
isNamedEntity()
Checks if a factoid answer is a named entity. |
void |
setAnswer(java.lang.String answer)
Sets the answer string. |
void |
setCacheID(java.lang.String cacheID)
Sets the ID of the document in the search engine cache. |
void |
setCorrect()
Judges the answer as correct. |
void |
setDocID(java.lang.String docID)
Sets the ID of a document that contains the answer. |
void |
setExtractionTechniques(java.lang.String[] techniques)
Sets the techniques a factoid answer was extracted with. |
void |
setNes(java.util.Map<java.lang.String,java.lang.String[]> nes)
Sets named entities extracted from a sentence-level answer and their types. |
void |
setNormScore(float normScore)
Sets the normalized score of this result. |
void |
setPredicate(Predicate predicate)
Sets a predicate extracted from a sentence-level answer. |
void |
setScore(float score)
Sets the confidence score of this result. |
void |
setSentence(java.lang.String sentence)
Sets the supporting sentence of a factoid answer. |
void |
setTerms(Term[] terms)
Sets terms extracted from a sentence-level answer. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final long serialVersionUID
private java.lang.String answer
private float score
private float normScore
private Query query
Query that was used to obtain the answer (optional).
private java.lang.String docID
private java.lang.String cacheID
private int hitPos
private boolean correct
private java.util.HashMap<java.lang.String,java.lang.Float> extraScores
private java.util.Map<java.lang.String,java.lang.String[]> nes
private Term[] terms
private Predicate predicate
private java.lang.String sentence
private java.lang.String[] neTypes
private java.lang.String[] extractionTechniques
private java.util.ArrayList<java.lang.String> coveredNuggets
| Constructor Detail |
|---|
public Result(java.lang.String answer)
Result object and sets the answer string.
answer - answer string
public Result(java.lang.String answer,
Query query)
Result object and sets the answer string and the
Query that was used to obtain the answer.
answer - answer stringquery - Query object
public Result(java.lang.String answer,
Query query,
java.lang.String docID)
Result object and sets the answer string, the
Query that was used to obtain the answer and the ID of a
document that contains it.
answer - answer stringquery - Query objectdocID - document ID
public Result(java.lang.String answer,
Query query,
java.lang.String docID,
int hitPos)
Result object and sets the answer string, the
Query that was used to obtain the answer, the ID of a
document that contains it and the hit position.
answer - answer stringquery - Query objectdocID - document IDhitPos - hit position, starting from 0| Method Detail |
|---|
public int compareTo(Result result)
compareTo in interface java.lang.Comparable<Result>result - the result to be compared
public boolean equals(java.lang.Object o)
equals in class java.lang.Objecto - the object to be compared
true iff the objects are equalpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String getAnswer()
public float getScore()
public float getNormScore()
public Query getQuery()
Query that was used to obtain this result, or
null if it is not set.
Query used to obtain this result or
nullpublic java.lang.String getDocID()
null if it is not set.
nullpublic java.lang.String getCacheID()
null if it is not set.
nullpublic int getHitPos()
public boolean isCorrect()
true iff the answer was judged as correctpublic java.util.Map<java.lang.String,java.lang.String[]> getNes()
null if no NEs have been extractedpublic Term[] getTerms()
null if no terms have been extractedpublic Predicate getPredicate()
null if no predicate has been extractedpublic java.lang.String getSentence()
null if it is not setpublic boolean isNamedEntity()
true iff the answer is a NEpublic java.lang.String[] getNeTypes()
null if the answer is not a NEpublic java.lang.String[] getExtractionTechniques()
public boolean extractedWith(java.lang.String technique)
technique - answer extraction technique
true iff the answer was extracted with the techniquepublic java.lang.String[] getCoveredNuggetIDs()
public void setAnswer(java.lang.String answer)
answer - the answer stringpublic void setScore(float score)
score - confidence scorepublic void incScore(float value)
value - the value to be added to the scorepublic void setNormScore(float normScore)
normScore - normalized scorepublic void setDocID(java.lang.String docID)
docID - document IDpublic void setCacheID(java.lang.String cacheID)
cacheID - ID of the cached documentpublic void setCorrect()
public void setNes(java.util.Map<java.lang.String,java.lang.String[]> nes)
nes - NEs and their typespublic void setTerms(Term[] terms)
terms - terms extracted from a sentencepublic void setPredicate(Predicate predicate)
predicate - predicate extracted from a sentencepublic void setSentence(java.lang.String sentence)
sentence - supporting sentencepublic boolean addNeType(java.lang.String neType)
neType - NE type
true if a new type was addedpublic void setExtractionTechniques(java.lang.String[] techniques)
techniques - answer extraction techniquespublic boolean addExtractionTechnique(java.lang.String technique)
technique - answer extraction technique
true iff a new technique was addedpublic void addCoveredNuggetID(java.lang.String nuggetID)
nuggetID - ID of the nugget to addpublic Result getCopy()
Result object.
public void addExtraScore(java.lang.String sourceName,
float score)
sourceName - the name of the source of the scorescore - the value of the scorepublic float getExtraScore(java.lang.String sourceName)
sourceName - the name of the source who set the required score
public float[] getExtraScores()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||