public class Relation extends Object implements Serializable, HasAttributes
Aug 4, 2009
Modifier and Type | Field and Description |
---|---|
protected Map<String,String> |
attributes |
protected Map<String,Double> |
labelsToScores |
protected int |
relationName |
protected double |
score |
protected Constituent |
source |
protected Constituent |
target |
Constructor and Description |
---|
Relation(Map<String,Double> labelsToScores,
Constituent source,
Constituent target)
Instantiates a Relation connecting two constituents with a set of labels and corresponding scores.
|
Relation(String relationName,
Constituent source,
Constituent target,
double score)
Instantiates a Relation connecting two Constituents with the name and score specified.
|
Modifier and Type | Method and Description |
---|---|
void |
addAttribute(String key,
String value) |
boolean |
equals(Object obj) |
String |
getAttribute(String key) |
Set<String> |
getAttributeKeys() |
Map<String,Double> |
getLabelsToScores()
return map of labels to scores.
|
String |
getRelationName() |
double |
getScore() |
Constituent |
getSource() |
Constituent |
getTarget() |
boolean |
hasAttribute(String key) |
int |
hashCode() |
void |
removeAllAttributes()
Removes all attributes from a Constituent.
|
String |
toString() |
protected final int relationName
protected Constituent source
protected Constituent target
protected double score
public Relation(Map<String,Double> labelsToScores, Constituent source, Constituent target)
getRelationName()
and getScore()
will
be the argmax and corresponding score from the labelsToScores argument.labelsToScores
- map from labels to scores.source
- constituent that is the source of the relationtarget
- constituent that is the target of the relationpublic Relation(String relationName, Constituent source, Constituent target, double score)
relationName
- name of relationsource
- constituent that is the source of the relationtarget
- constituent that is the target of the relationscore
- confidence score for relationpublic Map<String,Double> getLabelsToScores()
public String getRelationName()
public double getScore()
public Constituent getSource()
public Constituent getTarget()
public void addAttribute(String key, String value)
addAttribute
in interface HasAttributes
public String getAttribute(String key)
getAttribute
in interface HasAttributes
public Set<String> getAttributeKeys()
getAttributeKeys
in interface HasAttributes
public boolean hasAttribute(String key)
hasAttribute
in interface HasAttributes
public void removeAllAttributes()
removeAllAttributes
in interface HasAttributes
Copyright © 2017. All rights reserved.