if(uniqueRelations.contains(relationInfo)) {
continue;
}
uniqueRelations.add(relationInfo);
Span modifierSpan;
int modifierType;
// need to find out which of the two arguments is the modifier
if(Constants.modifierClasses.contains(entityTypes.get(relationInfo.id1))) {
Span first = entityMentions.get(relationInfo.id1).get(0);
Span last = entityMentions.get(relationInfo.id1).get(entityMentions.get(relationInfo.id1).size() - 1);
modifierSpan = new Span(first.start, last.end);
modifierType = Mapper.getModifierTypeId(entityTypes.get(relationInfo.id1));
}
else if(Constants.modifierClasses.contains(entityTypes.get(relationInfo.id2))) {
Span first = entityMentions.get(relationInfo.id2).get(0);
Span last = entityMentions.get(relationInfo.id2).get(entityMentions.get(relationInfo.id2).size() - 1);
modifierSpan = new Span(first.start, last.end);
modifierType = Mapper.getModifierTypeId(entityTypes.get(relationInfo.id2));
}
else {
continue; // neither of the arguments is a modifier; probably an annotation error
}
Span entityMentionSpan;
int entityMentionType;
// need to find out which of the two arguments is the entity mention
if(! Constants.modifierClasses.contains(entityTypes.get(relationInfo.id1))) {
Span first = entityMentions.get(relationInfo.id1).get(0);
Span last = entityMentions.get(relationInfo.id1).get(entityMentions.get(relationInfo.id1).size() - 1);
entityMentionSpan = new Span(first.start, last.end);
entityMentionType = Mapper.getEntityTypeId(entityTypes.get(relationInfo.id1));
}
else if(! Constants.modifierClasses.contains(entityTypes.get(relationInfo.id2))) {
Span first = entityMentions.get(relationInfo.id2).get(0);
Span last = entityMentions.get(relationInfo.id2).get(entityMentions.get(relationInfo.id2).size() - 1);
entityMentionSpan = new Span(first.start, last.end);
entityMentionType = Mapper.getEntityTypeId(entityTypes.get(relationInfo.id2));
}
else {
continue; // neither of the arguments is an entity mention; probably an annotation error
}