public class RelationMention extends ExtractionObject
| Modifier and Type | Field and Description |
|---|---|
protected List<String> |
argNames
List of argument names in this relation
|
protected List<ExtractionObject> |
args
List of arguments in this relation
If unnamed, arguments MUST be stored in semantic order, e.g., ARG0 must be a person in a employed-by relation
|
static Logger |
logger |
protected String |
signature
A signature for a given relation mention, e.g., a concatenation of type and argument strings
This is used in KBP, where we merge all RelationMentions corresponding to the same abstract relation
|
static String |
UNRELATED |
attributeMap, extentTokenSpan, objectId, sentence, subType, type, typeProbabilities| Constructor and Description |
|---|
RelationMention(String objectId,
CoreMap sentence,
Span span,
String type,
String subtype,
ExtractionObject... args) |
RelationMention(String objectId,
CoreMap sentence,
Span span,
String type,
String subtype,
List<ExtractionObject> args) |
RelationMention(String objectId,
CoreMap sentence,
Span span,
String type,
String subtype,
List<ExtractionObject> args,
List<String> argNames) |
| Modifier and Type | Method and Description |
|---|---|
void |
addArg(ExtractionObject a) |
boolean |
argsMatch(ExtractionObject... inputArgs) |
boolean |
argsMatch(List<ExtractionObject> inputArgs)
Verifies if the two sets of arguments match
|
boolean |
argsMatch(RelationMention rel) |
static RelationMention |
createUnrelatedRelation(RelationMentionFactory factory,
ExtractionObject... args) |
boolean |
equals(Object o) |
static Collection<RelationMention> |
filterUnrelatedRelations(Collection<RelationMention> relationMentions) |
ExtractionObject |
getArg(int argpos) |
List<String> |
getArgNames() |
List<ExtractionObject> |
getArgs() |
List<EntityMention> |
getEntityMentionArgs()
Fetches the arguments of this relation that are entity mentions
|
int |
getFirstSyntacticHeadPosition()
Find the left-most position of an argument's syntactic head
|
int |
getLastSyntacticHeadPosition()
Find the right-most position of an argument's syntactic head
|
String |
getSignature() |
int |
hashCode() |
boolean |
isNegativeRelation() |
static boolean |
isUnrelatedLabel(String label) |
static String |
makeUniqueId()
Creates a new unique id for a relation mention
|
boolean |
printableObject(double beam) |
void |
removeArgument(ExtractionObject argToRemove,
boolean removeParent) |
void |
removeArguments(Set<ExtractionObject> argsToRemove,
boolean removeParent) |
boolean |
replaceGoldArgsWithPredicted(List<EntityMention> predictedMentions)
Replaces the arguments of this relations with equivalent mentions from the predictedMentions list
This works only for arguments that are EntityMention!
|
void |
setArgNames(List<String> argNames) |
void |
setArgs(List<ExtractionObject> args) |
void |
setSignature(String s) |
String |
toString() |
attributeMap, concatenateTypes, getDocumentId, getExtent, getExtentString, getExtentTokenEnd, getExtentTokenStart, getFullValue, getObjectId, getSentence, getSpan, getSubType, getType, getTypeProbabilities, getValue, printableObject, setExtent, setSentence, setType, setTypeProbabilities, sortByExtentpublic static final Logger logger
public static final String UNRELATED
protected List<ExtractionObject> args
protected String signature
public RelationMention(String objectId, CoreMap sentence, Span span, String type, String subtype, List<ExtractionObject> args)
public RelationMention(String objectId, CoreMap sentence, Span span, String type, String subtype, List<ExtractionObject> args, List<String> argNames)
public boolean argsMatch(RelationMention rel)
public boolean argsMatch(ExtractionObject... inputArgs)
public boolean argsMatch(List<ExtractionObject> inputArgs)
inputArgs - List of argumentspublic List<ExtractionObject> getArgs()
public void setArgs(List<ExtractionObject> args)
public List<EntityMention> getEntityMentionArgs()
public ExtractionObject getArg(int argpos)
public void addArg(ExtractionObject a)
public boolean isNegativeRelation()
public int getFirstSyntacticHeadPosition()
public int getLastSyntacticHeadPosition()
public boolean replaceGoldArgsWithPredicted(List<EntityMention> predictedMentions)
predictedMentions - public void removeArgument(ExtractionObject argToRemove, boolean removeParent)
public void removeArguments(Set<ExtractionObject> argsToRemove, boolean removeParent)
public boolean printableObject(double beam)
public void setSignature(String s)
public String getSignature()
public static Collection<RelationMention> filterUnrelatedRelations(Collection<RelationMention> relationMentions)
public static String makeUniqueId()
public static RelationMention createUnrelatedRelation(RelationMentionFactory factory, ExtractionObject... args)
public static boolean isUnrelatedLabel(String label)
public boolean equals(Object o)
equals in class ExtractionObject