Examples of IdentifiedAnnotation


Examples of edu.mayo.bmi.uima.core.type.textsem.IdentifiedAnnotation

    //logger.info("    before iterating over named entities...");
    for (FeatureStructure featureStructure : annotationIndex)
    {
      //logger.info("    begin single named entity");
      IdentifiedAnnotation annotation = (IdentifiedAnnotation) featureStructure;

      int begin = annotation.getBegin();
      int end = annotation.getEnd();
      String conceptText = annotation.getCoveredText();

      //logger.info(String.format("NAMED ENTITY: \"%s\" [%d-%d]", conceptText,
      //    begin, end));

      Concept concept = new Concept(jcas, begin, end);
      concept.setConceptText(conceptText);
      concept.setConceptType(null);

      concept.setOriginalEntityExternalId(annotation.getAddress());

      FSArray ontologyConceptArray = annotation
          .getOntologyConceptArr();

      ConceptType conceptType = ConceptLookup
          .lookupConceptType(ontologyConceptArray);
View Full Code Here

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

      // collect all relevant relation arguments from the sentence
      List<IdentifiedAnnotationPair> candidatePairs = this.getCandidateRelationArgumentPairs(identifiedAnnotationView, sentence);

      // walk through the pairs of annotations
      for (IdentifiedAnnotationPair pair : candidatePairs) {
        IdentifiedAnnotation arg1 = pair.getArg1();
        IdentifiedAnnotation arg2 = pair.getArg2();
        // apply all the feature extractors to extract the list of features
        List<Feature> features = new ArrayList<Feature>();
        for (RelationFeaturesExtractor extractor : this.featureExtractors) {
          features.addAll(extractor.extract(jCas, arg1, arg2));
        }

        // sanity check on feature values
        for (Feature feature : features) {
          if (feature.getValue() == null) {
            String message = "Null value found in %s from %s";
            throw new IllegalArgumentException(String.format(message, feature, features));
          }
        }

        // during training, feed the features to the data writer
        if (this.isTraining()) {
          String category = this.getRelationCategory(relationLookup, arg1, arg2);
          if (category == null) { continue; }
         
          // create a classification instance and write it to the training data
          this.dataWriter.write(new Instance<String>(category, features));
        }

        // during classification feed the features to the classifier and create annotations
        else {
          String predictedCategory = this.classifier.classify(features);

          if(printErrors) {
            String goldCategory; // gold standard relation category
            if (categoryLookup.containsKey(new HashableArguments(arg1, arg2))) {
              goldCategory = categoryLookup.get(new HashableArguments(arg1, arg2));
            } else {
              goldCategory = NO_RELATION_CATEGORY;
            }

            logResults(sentence, arg1, arg2, features, predictedCategory, goldCategory);
          }
         
          // add a relation annotation if a true relation was predicted
          if (!predictedCategory.equals(NO_RELATION_CATEGORY)) {

            // if we predict an inverted relation, reverse the order of the arguments
            if (predictedCategory.endsWith("-1")) {
              predictedCategory = predictedCategory.substring(0, predictedCategory.length() - 2);
              IdentifiedAnnotation temp = arg1;
              arg1 = arg2;
              arg2 = temp;
            }

            // add the relation to the CAS
View Full Code Here

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

              UmlsConcept uc = (UmlsConcept) conceptItr.next();
              conceptArr.set(arrIdx, uc);
              arrIdx++;
            }

            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);
            neAnnot.setEnd(neEnd);
            neAnnot.setDiscoveryTechnique(CONST.NE_DISCOVERY_TECH_DICT_LOOKUP);
            neAnnot.setOntologyConceptArr(conceptArr);
            neAnnot.addToIndexes();
          }
         
        }
      }
    }
View Full Code Here

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

      }

      if (validCodeCol.size() > 0)
      {
        FSArray ocArr = createOntologyConceptArr(jcas, validCodeCol);
        IdentifiedAnnotation neAnnot = new MedicationEventMention(jcas); // medication NEs are EventMention
        neAnnot.setTypeID(CONST.NE_TYPE_ID_DRUG);
        neAnnot.setBegin(neBegin);
        neAnnot.setEnd(neEnd);
        neAnnot.setDiscoveryTechnique(CONST.NE_DISCOVERY_TECH_DICT_LOOKUP);
        neAnnot.setOntologyConceptArr(ocArr);
        neAnnot.addToIndexes();
      }
    }
  }
View Full Code Here

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

          tid = CONST.NE_TYPE_ID_UNKNOWN;
        }
       
      }

      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);
      neAnnot.setDiscoveryTechnique(CONST.NE_DISCOVERY_TECH_DICT_LOOKUP);
      neAnnot.setOntologyConceptArr(ocArr);
      neAnnot.setTypeID(tid);
      neAnnot.addToIndexes();     
    }
  }
View Full Code Here

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

      return "N";
  }

  public String calcmWnClass () {
    if (m.getContent() instanceof IdentifiedAnnotation) {
      IdentifiedAnnotation ne = (IdentifiedAnnotation) m.getContent();
      return String.valueOf(ne.getTypeID());
    } else
      return "0";
  }
View Full Code Here

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

        ra2.addToIndexes();
        cr.addToIndexes();
        ppt.union(m2q.get(anaphor), m2q.get(bestAnte.m));
        if(anaphor instanceof PronounMarkable){
          // if the anaphor is a pronoun then it won't be in the cas as an identifiedannotation so we need to add it.
          IdentifiedAnnotation ia = new IdentifiedAnnotation(jcas);
         
        }
      }else{
//        indexNegativeExample(jcas, bestAnte.m, anaphor, bestAnte.prob);
      }
View Full Code Here

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

  //  }

  public String calcWnClassC () {
    if (m1.getContent() instanceof IdentifiedAnnotation &&
        m2.getContent() instanceof IdentifiedAnnotation) {
        IdentifiedAnnotation ne1 = (IdentifiedAnnotation) m1.getContent();
        IdentifiedAnnotation ne2 = (IdentifiedAnnotation) m2.getContent();
        if (ne1.getTypeID() == ne2.getTypeID())
          return "C";
        else return "N";
      } else
        return "N";
  }
View Full Code Here

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

  }

  public String calcWnClassI () {
    if (m1.getContent() instanceof IdentifiedAnnotation &&
        m2.getContent() instanceof IdentifiedAnnotation) {
        IdentifiedAnnotation ne1 = (IdentifiedAnnotation) m1.getContent();
        IdentifiedAnnotation ne2 = (IdentifiedAnnotation) m2.getContent();
        if (ne1.getTypeID() != ne2.getTypeID())
          return "Y";
        else return "N";
      } else
        return "N";
  }
View Full Code Here

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

  }

  public String calcWnClass () {
    if (m1.getContent() instanceof IdentifiedAnnotation &&
      m2.getContent() instanceof IdentifiedAnnotation) {
      IdentifiedAnnotation ne1 = (IdentifiedAnnotation) m1.getContent();
      IdentifiedAnnotation ne2 = (IdentifiedAnnotation) m2.getContent();
      if (ne1.getTypeID() == ne2.getTypeID())
        return "C";
      else return "I";
    } else
      return "NA";
  }
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.