@Override public void process(JCas jCas) throws AnalysisEngineProcessException { JCas goldView; try { goldView = jCas.getView(GOLD_VIEW_NAME); } catch (CASException e) { throw new AnalysisEngineProcessException(e); } // remove any automatically generated Modifiers for (EntityMention entityMention : JCasUtil.select(jCas, EntityMention.class)) { entityMention.removeFromIndexes(); } // copy over the manually annotated Modifiers for (EntityMention entityMention : JCasUtil.select(goldView, EntityMention.class)) { EntityMention newEntityMention = new EntityMention(jCas, entityMention.getBegin(), entityMention.getEnd()); newEntityMention.setTypeID(entityMention.getTypeID()); newEntityMention.setId(entityMention.getId()); newEntityMention.setDiscoveryTechnique(entityMention.getDiscoveryTechnique()); newEntityMention.setConfidence(entityMention.getConfidence()); newEntityMention.addToIndexes(); } } }
/** @generated * @param jcas JCas to which this Feature Structure belongs * @param begin offset to the begin spot in the SofA * @param end offset to the end spot in the SofA */ public EntityMention(JCas jcas, int begin, int end) { super(jcas); setBegin(begin); setEnd(end); readObject(); }
EntityMention newGoldEntityMention = new EntityMention(goldView, oldSystemEntityMention.getBegin(), oldSystemEntityMention.getEnd()); newGoldEntityMention.setDiscoveryTechnique(oldSystemEntityMention.getDiscoveryTechnique()); newGoldEntityMention.setUncertainty(oldSystemEntityMention.getUncertainty()); newGoldEntityMention.setConditional(oldSystemEntityMention.getConditional()); newGoldEntityMention.setGeneric(oldSystemEntityMention.getGeneric()); newGoldEntityMention.setPolarity(oldSystemEntityMention.getPolarity()); newGoldEntityMention.setSubject(oldSystemEntityMention.getSubject()); newGoldEntityMention.setHistoryOf(oldSystemEntityMention.getHistoryOf()); newGoldEntityMention.setConfidence(oldSystemEntityMention.getConfidence()); newGoldEntityMention.setTypeID(oldSystemEntityMention.getTypeID()); newGoldEntityMention.addToIndexes();
Matcher matcher = pattern.matcher(annoText); while (matcher.find()) { EntityMention ne = new EntityMention(aJCas); ne.setBegin(nOffset + matcher.start()); ne.setEnd(nOffset + matcher.end()); FSArray ocArr = new FSArray(aJCas, 1); OntologyConcept oc = new OntologyConcept(aJCas); oc.setOid(neRegex.getOid()); ocArr.set(0, oc); ne.setOntologyConceptArr(ocArr); ne.addToIndexes();
private void addNamedEntity(JCas jcas, int begin, int end, Map<String, OntologyConcept> concepts, boolean bMedication, Set<NegSpan> negSet) { if (concepts.isEmpty()) return; IdentifiedAnnotation neLast = bMedication ? new MedicationEventMention( jcas) : new EntityMention(jcas); neLast.setPolarity(negSet.contains(new NegSpan(begin, end)) ? CONST.NE_POLARITY_NEGATION_PRESENT : CONST.NE_POLARITY_NEGATION_ABSENT); neLast.setBegin(begin); neLast.setEnd(end); FSArray ocArr = new FSArray(jcas, concepts.size()); int ocArrIdx = 0; for (OntologyConcept oc : concepts.values()) { // set the cui field if this is in fact a cui ocArr.set(ocArrIdx, oc); ocArrIdx++; } neLast.setOntologyConceptArr(ocArr); concepts.clear(); neLast.addToIndexes(); }
/** Internal - constructor used by generator * @generated * @param addr low level Feature Structure reference * @param type the type of this Feature Structure */ public EntityMention(int addr, TOP_Type type) { super(addr, type); readObject(); }
for (EntityMention arg1 : args) { for (EntityMention arg2 : args) { if (arg1.getBegin() == arg2.getBegin() && arg1.getEnd() == arg2.getEnd()) { continue; int legitimateArg2Count = 0; for(EntityMention entityMention : args) { if(entityMention.getTypeID() == 6) { legitimateArg1Count++; if(okArg2Types.contains(entityMention.getTypeID())) { legitimateArg2Count++;
EntityMention arg2 = args.get(j); if (i == j || (arg1.getBegin() == arg2.getBegin() && arg1.getEnd() == arg2.getEnd())) { continue; String relationString = category + "(\"" + arg1.getCoveredText() + "\", \"" + arg2.getCoveredText() + "\")"; rels.print("\t"); rels.print(lineNum);
private static List<EntityMention> getAnatomicalSites(List<EntityMention> entityMentions) { List<EntityMention> anatomicalSites = new ArrayList<EntityMention>(); for(EntityMention entityMention : entityMentions) { if(entityMention.getTypeID() == 6) { anatomicalSites.add(entityMention); } } return anatomicalSites; }
logger.error("Need to implement cases for handling EntityMention " + entityMention + " within relation: " + relation); logger.error(" loc " + loc + " in relation " + relation + " with/to " + entityMention); logger.error(" Using covered text: loc " + loc.getCoveredText() + " in relation " + relation + " with/to " + entityMention.getCoveredText()); logger.error("Need to implement cases for handling EntityMention " + entityMention + " within relation: " + relation); logger.error(" severity " + severity + " in relation " + relation + " with/to " + entityMention); logger.error(" Using covered text: severity " + severity.getCoveredText() + " in relation " + relation + " with/to " + entityMention.getCoveredText()); } else { EventMention eventMention = (EventMention) ia;
EntityMention newGoldEntityMention = new EntityMention(goldView, oldSystemEntityMention.getBegin(), oldSystemEntityMention.getEnd()); newGoldEntityMention.setDiscoveryTechnique(oldSystemEntityMention.getDiscoveryTechnique()); newGoldEntityMention.setUncertainty(oldSystemEntityMention.getUncertainty()); newGoldEntityMention.setConditional(oldSystemEntityMention.getConditional()); newGoldEntityMention.setGeneric(oldSystemEntityMention.getGeneric()); newGoldEntityMention.setPolarity(oldSystemEntityMention.getPolarity()); newGoldEntityMention.setSubject(oldSystemEntityMention.getSubject()); newGoldEntityMention.setHistoryOf(oldSystemEntityMention.getHistoryOf()); newGoldEntityMention.setConfidence(oldSystemEntityMention.getConfidence()); newGoldEntityMention.setTypeID(oldSystemEntityMention.getTypeID()); newGoldEntityMention.addToIndexes();
Matcher matcher = pattern.matcher(annoText); while (matcher.find()) { EntityMention ne = new EntityMention(aJCas); ne.setBegin(nOffset + matcher.start()); ne.setEnd(nOffset + matcher.end()); FSArray ocArr = new FSArray(aJCas, 1); OntologyConcept oc = new OntologyConcept(aJCas); oc.setOid(neRegex.getOid()); ocArr.set(0, oc); ne.setOntologyConceptArr(ocArr); ne.addToIndexes();
private void addNamedEntity(JCas jcas, int begin, int end, Map<String, OntologyConcept> concepts, boolean bMedication, Set<NegSpan> negSet) { if (concepts.isEmpty()) return; IdentifiedAnnotation neLast = bMedication ? new MedicationEventMention( jcas) : new EntityMention(jcas); neLast.setPolarity(negSet.contains(new NegSpan(begin, end)) ? CONST.NE_POLARITY_NEGATION_PRESENT : CONST.NE_POLARITY_NEGATION_ABSENT); neLast.setBegin(begin); neLast.setEnd(end); FSArray ocArr = new FSArray(jcas, concepts.size()); int ocArrIdx = 0; for (OntologyConcept oc : concepts.values()) { // set the cui field if this is in fact a cui ocArr.set(ocArrIdx, oc); ocArrIdx++; } neLast.setOntologyConceptArr(ocArr); concepts.clear(); neLast.addToIndexes(); }
/** @generated * @param jcas JCas to which this Feature Structure belongs */ public EntityMention(JCas jcas) { super(jcas); readObject(); }
for (EntityMention arg1 : args) { for (EntityMention arg2 : args) { if (arg1.getBegin() == arg2.getBegin() && arg1.getEnd() == arg2.getEnd()) { continue; int legitimateArg2Count = 0; for(EntityMention entityMention : args) { if(entityMention.getTypeID() == 6) { legitimateArg1Count++; if(okArg2Types.contains(entityMention.getTypeID())) { legitimateArg2Count++;
EntityMention arg2 = args.get(j); if (i == j || (arg1.getBegin() == arg2.getBegin() && arg1.getEnd() == arg2.getEnd())) { continue; String relationString = category + "(\"" + arg1.getCoveredText() + "\", \"" + arg2.getCoveredText() + "\")"; rels.print("\t"); rels.print(lineNum);
private static List<EntityMention> getAnatomicalSites(List<EntityMention> entityMentions) { List<EntityMention> anatomicalSites = new ArrayList<EntityMention>(); for(EntityMention entityMention : entityMentions) { if(entityMention.getTypeID() == 6) { anatomicalSites.add(entityMention); } } return anatomicalSites; }
@Override public void process(JCas jCas) throws AnalysisEngineProcessException { JCas goldView; try { goldView = jCas.getView(GOLD_VIEW_NAME); } catch (CASException e) { throw new AnalysisEngineProcessException(e); } // remove any automatically generated Modifiers for (EntityMention entityMention : JCasUtil.select(jCas, EntityMention.class)) { entityMention.removeFromIndexes(); } // copy over the manually annotated Modifiers for (EntityMention entityMention : JCasUtil.select(goldView, EntityMention.class)) { EntityMention newEntityMention = new EntityMention(jCas, entityMention.getBegin(), entityMention.getEnd()); newEntityMention.setTypeID(entityMention.getTypeID()); newEntityMention.setId(entityMention.getId()); newEntityMention.setDiscoveryTechnique(entityMention.getDiscoveryTechnique()); newEntityMention.setConfidence(entityMention.getConfidence()); newEntityMention.addToIndexes(); } } }