first = mention.getValue().get(0);
last = mention.getValue().get(mention.getValue().size() - 1);
// put entity and attributes into the CAS
// choose either entity or event
IdentifiedAnnotation eMention;
int type = Mapper.getEntityTypeId(entityTypes.get(mentionId));
if (type==CONST.NE_TYPE_ID_ANATOMICAL_SITE) {
eMention = new EntityMention(initView, first.start, last.end);
} else if (type==CONST.NE_TYPE_ID_DISORDER
|| type==CONST.NE_TYPE_ID_DRUG
|| type==CONST.NE_TYPE_ID_FINDING
|| type==CONST.NE_TYPE_ID_PROCEDURE
|| type==CONST.NE_TYPE_ID_ANATOMICAL_SITE
) {
eMention = new EventMention(initView, first.start, last.end);
} else {
eMention = new IdentifiedAnnotation(initView, first.start, last.end);
}
// set easy attributes
eMention.setTypeID(Mapper.getEntityTypeId(entityTypes.get(mentionId)));
eMention.setId(identifiedAnnotationId++);
eMention.setDiscoveryTechnique(CONST.NE_DISCOVERY_TECH_GOLD_ANNOTATION);
eMention.setConfidence(1);
if (mentionId.endsWith("4351")) {
System.out.println();
}
List<ArgumentInfo> assocAttributes = getLeafAttributes(mentionId,
mentionAttr,attrPtr,attrs,new ArrayList<ArgumentInfo>());
for (ArgumentInfo a : assocAttributes) {
// // set harder attributes from cas -- look through all attribute ids attached to this mentionId
// for (String attrId : mentionAttr.get(mentionId) ) {
// // make sure this attribute was actually somewhere in the knowtator file
// if (!attrs.containsKey(attrId)) {
// if (VERBOSE) { System.err.println("WARNING: attribute not found: "+attrId); }
// continue;
// }
// look up the attribute id and set values accordingly
checkForAttrValue(eMention, a.role, a.value);
}
// add to CAS
eMention.addToIndexes();
}
}