Examples of EntityMention


Examples of org.apache.ctakes.typesystem.type.textsem.EntityMention

      Map<String, KnowtatorAnnotation> annotationSlots = new HashMap<String, KnowtatorAnnotation>(
          annotation.annotationSlots);
      KnowtatorAnnotation.Span coveringSpan = annotation.getCoveringSpan();

      if ("Anatomical_site".equals(annotation.type)) {
        EntityMention entityMention = new EntityMention(jCas, coveringSpan.begin, coveringSpan.end);
        addEntityMentionFeatures(
            annotation,
            entityMention,
            jCas,
            CONST.NE_TYPE_ID_ANATOMICAL_SITE,
            stringSlots,
            booleanSlots,
            annotationSlots,
            idAnnotationMap,
            delayedFeatures);
        KnowtatorAnnotation bodySide = annotationSlots.remove("body_side");
        if (bodySide != null) {
          delayedFeatures.add(new DelayedFeature<EntityMention>(entityMention, bodySide) {
            @Override
            protected void setValue(TOP valueAnnotation) {
              // TODO: this.annotation.setBodySide(...)
            }
          });
        }
        KnowtatorAnnotation bodyLaterality = annotationSlots.remove("body_laterality");
        if (bodyLaterality != null) {
          delayedFeatures.add(new DelayedFeature<EntityMention>(entityMention, bodyLaterality) {
            @Override
            protected void setValue(TOP valueAnnotation) {
              // TODO: this.annotation.setBodyLaterality(...)
            }
          });
        }

      } else if ("Disease_Disorder".equals(annotation.type)) {
        EntityMention entityMention = new EntityMention(jCas, coveringSpan.begin, coveringSpan.end);
        addEntityMentionFeatures(
            annotation,
            entityMention,
            jCas,
            CONST.NE_TYPE_ID_DISORDER,
            stringSlots,
            booleanSlots,
            annotationSlots,
            idAnnotationMap,
            delayedFeatures);
        KnowtatorAnnotation bodyLocation = annotationSlots.remove("body_location");
        if (bodyLocation != null) {
          delayedFeatures.add(new DelayedFeature<EntityMention>(entityMention, bodyLocation) {
            @Override
            protected void setValue(TOP valueAnnotation) {
              // TODO: this.annotation.setBodyLocation(...)
            }
          });
        }
        KnowtatorAnnotation severity = annotationSlots.remove("severity");
        if (severity != null) {
          delayedFeatures.add(new DelayedFeature<EntityMention>(entityMention, severity) {
            @Override
            protected void setValue(TOP valueAnnotation) {
              // TODO: this.annotation.setSeverity(...)
            }
          });
        }

      } else if ("Medications/Drugs".equals(annotation.type)) {
        EntityMention entityMention = new EntityMention(jCas, coveringSpan.begin, coveringSpan.end);
        addEntityMentionFeatures(
            annotation,
            entityMention,
            jCas,
            CONST.NE_TYPE_ID_DRUG,
            stringSlots,
            booleanSlots,
            annotationSlots,
            idAnnotationMap,
            delayedFeatures);

      } else if ("Phenomena".equals(annotation.type)) {
        EntityMention entityMention = new EntityMention(jCas, coveringSpan.begin, coveringSpan.end);
        addEntityMentionFeatures(
            annotation,
            entityMention,
            jCas,
            CONST.NE_TYPE_ID_UNKNOWN /* TODO: is this the correct type? */,
            stringSlots,
            booleanSlots,
            annotationSlots,
            idAnnotationMap,
            delayedFeatures);

      } else if ("Procedure".equals(annotation.type)) {
        EntityMention entityMention = new EntityMention(jCas, coveringSpan.begin, coveringSpan.end);
        addEntityMentionFeatures(
            annotation,
            entityMention,
            jCas,
            CONST.NE_TYPE_ID_PROCEDURE,
            stringSlots,
            booleanSlots,
            annotationSlots,
            idAnnotationMap,
            delayedFeatures);
        KnowtatorAnnotation bodyLocation = annotationSlots.remove("body_location");
        if (bodyLocation != null) {
          delayedFeatures.add(new DelayedFeature<EntityMention>(entityMention, bodyLocation) {
            @Override
            protected void setValue(TOP valueAnnotation) {
              // TODO: this.annotation.setBodyLocation(...)
            }
          });
        }
        KnowtatorAnnotation historyOf = annotationSlots.remove("historyOf_CU");
        if (historyOf != null) {
          delayedFeatures.add(new DelayedFeature<EntityMention>(entityMention, historyOf) {
            @Override
            protected void setValue(TOP valueAnnotation) {
              // TODO: this.annotation.setHistoryOf(...)
            }
          });
        }

      } else if ("Sign_symptom".equals(annotation.type)) {
        EntityMention entityMention = new EntityMention(jCas, coveringSpan.begin, coveringSpan.end);
        addEntityMentionFeatures(
            annotation,
            entityMention,
            jCas,
            CONST.NE_TYPE_ID_FINDING,
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.textsem.EntityMention

            IdentifiedAnnotation neAnnot;
            if (neType.intValue() == CONST.NE_TYPE_ID_DRUG) {
              neAnnot = new MedicationEventMention(jcas)
            } else {
              neAnnot = new EntityMention(jcas)
           
            }

            neAnnot.setTypeID(neType.intValue());
            neAnnot.setBegin(neBegin);
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.textsem.EntityMention

      IdentifiedAnnotation neAnnot;
      if (tid == CONST.NE_TYPE_ID_DRUG || tid == CONST.NE_TYPE_ID_UNKNOWN) {
        neAnnot = new MedicationEventMention(jcas)
      } else {
        neAnnot = new EntityMention(jcas)
     
      }
     
      neAnnot.setBegin(neBegin);
      neAnnot.setEnd(neEnd);
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.textsem.EntityMention

    tokenBuilder.buildTokens(
        jCas,
        "He had a slight fracture in the proximal right fibula.",
        "He had a slight fracture in the proximal right fibula .",
        "PRP VBD DT JJ NN IN DT JJ JJ NN .");
    EntityMention fracture = new EntityMention(jCas, 16, 24);
    fracture.setTypeID(CONST.NE_TYPE_ID_DISORDER);
    fracture.addToIndexes();
    assertEquals("fracture", fracture.getCoveredText());
    EntityMention fibula = new EntityMention(jCas, 32, 53);
    fibula.setTypeID(CONST.NE_TYPE_ID_ANATOMICAL_SITE);
    fibula.addToIndexes();
    assertEquals("proximal right fibula", fibula.getCoveredText());

    // run the analysis engine
    engine.process(jCas);

    // test the modifier annotator
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.textsem.EntityMention

  public static ArrayList<Annotation> selectNE (JCas jcas) {
    ArrayList<Annotation> ret = new ArrayList<Annotation>();
    FSIterator iter = jcas.getJFSIndexRepository().getAnnotationIndex(EntityMention.type).iterator();
    while (iter.hasNext()) {
      EntityMention a = (EntityMention) iter.next();
      if(a.getOntologyConceptArr() != null)
//      int tid = a.getTypeID();
//      if (tid == TypeSystemConst.NE_TYPE_ID_ANATOMICAL_SITE ||
//        tid == TypeSystemConst.NE_TYPE_ID_DISORDER ||
//        tid == TypeSystemConst.NE_TYPE_ID_PROCEDURE ||
//        tid == TypeSystemConst.NE_TYPE_ID_FINDING)
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.textsem.EntityMention

      // run the analysis engine
      AnnotationIndex<Annotation> mentions = jCas.getAnnotationIndex(EntityMention.type);
    Iterator<Annotation> iter =mentions.iterator();
    int emCount = 0;
    while(iter.hasNext()) {
      EntityMention em = (EntityMention)iter.next();
      System.out.println("[" + em.getCoveredText() + "]");
      emCount ++;
    }
    Assert.assertTrue(emCount == 1);
  }
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.textsem.EntityMention

    System.setProperty("ytex.conceptSetName", "");
    JCas jCas = JCasFactory
        .createJCasFromPath("src/main/resources/org/apache/ctakes/ytex/types/TypeSystem.xml");
    String text = "concept1 concept2 concept3";
    jCas.setDocumentText(text);
    EntityMention em1 = new EntityMention(jCas);
    em1.setBegin(0);
    em1.setEnd(8);
    setConcepts(jCas, em1, new String[] { "dog" });
    em1.addToIndexes();

    EntityMention em2 = new EntityMention(jCas);
    em2.setBegin(9);
    em2.setEnd(17);
    setConcepts(jCas, em2, new String[] { "e coli", "animal" });
    em2.addToIndexes();
   
    EntityMention em3 = new EntityMention(jCas);
    em3.setBegin(18);
    em3.setEnd(26);
    setConcepts(jCas, em3, new String[] { "cat" });
    em3.addToIndexes();
   
    SenseDisambiguatorAnnotator sda = new SenseDisambiguatorAnnotator();
    sda.wsd = ApplicationContextHolder.getApplicationContext().getBean(
        WordSenseDisambiguator.class);
    sda.process(jCas);
    AnnotationIndex<Annotation> annoIdx = jCas.getAnnotationIndex(EntityMention.type);
    List<Annotation> annoList = Lists.newArrayList(annoIdx);
    EntityMention emD = (EntityMention)annoList.get(1);
    FSArray fsa = emD.getOntologyConceptArr();
    for(int i = 0; i < fsa.size(); i++) {
      OntologyConcept oc = (OntologyConcept)fsa.get(i);
      if("animal".equals(oc.getCode())) {
        Assert.assertTrue(oc.getDisambiguated());
      } else {
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.textsem.EntityMention

        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();
      }
    }
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.textsem.EntityMention

//        modifier.removeFromIndexes();
//      }
     
      for (EntityMention oldSystemEntityMention : JCasUtil.select(jCas, EntityMention.class))
      {
        EntityMention newGoldEntityMention = new EntityMention(goldView, oldSystemEntityMention.getBegin(), oldSystemEntityMention.getEnd());
       
        // copying assertion fields
        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());

        // copying non-assertion fields
        newGoldEntityMention.setConfidence(oldSystemEntityMention.getConfidence());
        newGoldEntityMention.setTypeID(oldSystemEntityMention.getTypeID());
       
        newGoldEntityMention.addToIndexes();
      }

      for (EventMention oldSystemEventMention : JCasUtil.select(jCas, EventMention.class))
      {
        EventMention newGoldEventMention = new EventMention(goldView, oldSystemEventMention.getBegin(), oldSystemEventMention.getEnd());
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.textsem.EntityMention

        // 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
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.