Package org.apache.ctakes.typesystem.type.refsem

Examples of org.apache.ctakes.typesystem.type.refsem.OntologyConcept


    // convert code to ontology concept or CUI
    String code = stringSlots.remove("AssociateCode");
    if (code == null) {
      code = stringSlots.remove("associatedCode");
    }
    OntologyConcept ontologyConcept;
    if (entityMention.getTypeID() == CONST.NE_TYPE_ID_DRUG) {
      ontologyConcept = new OntologyConcept(jCas);
      ontologyConcept.setCode(code);
    } else {
      UmlsConcept umlsConcept = new UmlsConcept(jCas);
      umlsConcept.setCui(code);
      ontologyConcept = umlsConcept;
    }
    ontologyConcept.addToIndexes();
    entityMention.setOntologyConceptArr(new FSArray(jCas, 1));
    entityMention.setOntologyConceptArr(0, ontologyConcept);

    // add entity mention to CAS
    entityMention.addToIndexes();
View Full Code Here


    int ocArrIdx = 0;
    Iterator validCodeItr = validCodeCol.iterator();
    while (validCodeItr.hasNext())
    {
      String validCode = (String) validCodeItr.next();
      OntologyConcept oc = new OntologyConcept(jcas);
      oc.setCode(validCode);
      oc.setCodingScheme(iv_props.getProperty(CODING_SCHEME_PRP_KEY));

      ocArr.set(ocArrIdx, oc);
      ocArrIdx++;
    }
    return ocArr;
View Full Code Here

        String code = mdh.getMetaFieldValue(iv_props.getProperty(CODE_MF_PRP_KEY));
        if (codes.contains(code)) {
          // don't create a second entry in the array for a code already seen, including null
        } else {
         
          OntologyConcept oc = new OntologyConcept(jcas);
          oc.setCode(code);
          oc.setCodingScheme(iv_props.getProperty(CODING_SCHEME_PRP_KEY));

          if(iv_props.getProperty(TYPE_ID_FIELD) != null) {
            typeId = iv_props.getProperty(TYPE_ID_FIELD);//mdh.getMetaFieldValue(iv_props.getProperty(TYPE_ID_FIELD));
          }
         
View Full Code Here

    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 {
        Assert.assertFalse(oc.getDisambiguated());
      }
    }
  }
View Full Code Here

  }

  private void setConcepts(JCas jCas, EntityMention em1, String[] concepts) {
    FSArray em1oc = new FSArray(jCas, concepts.length);
    for (int i = 0; i < concepts.length; i++) {
      OntologyConcept oc1 = new OntologyConcept(jCas);
      oc1.setCode(concepts[i]);
      em1oc.set(i, oc1);
    }
    em1.setOntologyConceptArr(em1oc);
  }
View Full Code Here

    // convert code to ontology concept or CUI
    String code = stringSlots.remove("AssociateCode");
    if (code == null) {
      code = stringSlots.remove("associatedCode");
    }
    OntologyConcept ontologyConcept;
    if (mention.getTypeID() == CONST.NE_TYPE_ID_DRUG) {
      ontologyConcept = new OntologyConcept(jCas);
      ontologyConcept.setCode(code);
    } else {
      UmlsConcept umlsConcept = new UmlsConcept(jCas);
      umlsConcept.setCui(code);
      ontologyConcept = umlsConcept;
    }
    ontologyConcept.addToIndexes();
    mention.setOntologyConceptArr(new FSArray(jCas, 1));
    mention.setOntologyConceptArr(0, ontologyConcept);

    // add entity mention to CAS
    mention.addToIndexes();
View Full Code Here

        if(log.isTraceEnabled())
          log.trace("i: " + i + ", concept: " + concept);
        IdentifiedAnnotation ne = listNonTrivialNE.get(i);
        FSArray concepts = ne.getOntologyConceptArr();
        for (int j = 0; j < concepts.size(); j++) {
          OntologyConcept yoc = (OntologyConcept) concepts.get(j);
          String conceptId = this.getConceptId(yoc);
          // update the score and set the predicted concept field
          if (concept == null || concept.equals(conceptId))
            yoc.setDisambiguated(true);
          if (scores.containsKey(conceptId))
            yoc.setScore(scores.get(conceptId));

        }
      } else if (conceptSenses.size() == 1) {
        // only one concept - for ytex concept set the predicted concept
        IdentifiedAnnotation ne = listNonTrivialNE.get(i);
        FSArray concepts = ne.getOntologyConceptArr();
        OntologyConcept oc = (OntologyConcept) concepts.get(0);
        oc.setDisambiguated(true);
      }
    }
  }
View Full Code Here

      Map<String, OntologyConcept> concepts, Annotation annoCandidate,
      Feature cuiFeature, Feature tuiFeature, boolean bMedication) {
    String cui = annoCandidate.getStringValue(cuiFeature);
    if (concepts.containsKey(cui))
      return bMedication;
    OntologyConcept oc = new OntologyConcept(jcas);
    oc.setCode(cui);
    oc.setCodingScheme("METAMAP");
    StringArray tuiArr = (StringArray) annoCandidate
        .getFeatureValue(tuiFeature);
    List<String> tuis = null;
    if (tuiArr != null)
      tuis = Arrays.asList(tuiArr.toStringArray());
View Full Code Here

    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.setCode(neRegex.getCode());
      oc.setCodingScheme(neRegex.getCodingScheme());
      oc.setOid(neRegex.getOid());
      ocArr.set(0, oc);
      ne.setOntologyConceptArr(ocArr);
      ne.addToIndexes();
    }
  }
View Full Code Here

      FSArray ocArr = tokenAnt.getOntologyConceptArr();
      if (ocArr != null)
      {
        for (int i = 0; i < ocArr.size() && !isDrugNER; i++)
        {
          OntologyConcept oc = (OntologyConcept) ocArr.get(i);

          String scheme = oc.getCodingScheme();
          //if (scheme.compareTo("RXNORM") == 0)
          //{
            isDrugNER = true;
          //}
View Full Code Here

TOP

Related Classes of org.apache.ctakes.typesystem.type.refsem.OntologyConcept

Copyright © 2018 www.massapicom. 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.