Package org.mitre.medfacts.i2b2.util

Examples of org.mitre.medfacts.i2b2.util.Location


      trainingInstance.setLineNumber(lineNumber);
      trainingInstance.setAssertAnnotateForTI(currentAssertionAnnotation); //link training instance to corresponding assertion
      trainingInstance.setAnnotationsForLine(allLineAnnotations); //list of annotations for the line this training instance is on
      trainingInstance.setTokensForLine(textLookup[lineNumber-1]); //token string for the line this training instance is on

      AssertionValue assertionValue = currentAssertionAnnotation.getAssertionValue();
      String assertionValueString = (assertionValue == null) ? "" : assertionValue.toString().toLowerCase();
      trainingInstance.setExpectedValue(assertionValueString);

      String conceptText = currentAssertionAnnotation.getConceptText();
      if (checkForEnabledFeature("conceptTextFeature"))
      {
View Full Code Here


      String actualAssertionValueString = decoder.classifyInstance(featureList);

      AssertionAnnotation originalAssertion = currentEvalInstance.getAssertAnnotateForTI();
      AssertionAnnotation resultAssertion = new AssertionAnnotation();

      AssertionValue actualAssertionValue = null;
      if (actualAssertionValueString != null)
      {
        actualAssertionValue = AssertionValue.valueOf(actualAssertionValueString.toUpperCase());
      }
      resultAssertion.setAssertionValue(actualAssertionValue);
View Full Code Here

              trainingInstance.addFeature("cueword_" + cueWord.getCueWordText());
            }
          }
          if (checkForEnabledFeature("concepts")) {
            if (a instanceof ConceptAnnotation) {
                ConceptAnnotation concept = (ConceptAnnotation) a;
                if ((concept.getConceptType() != null) && (concept.getConceptText() != null)) {
                //System.err.println("concept: " + concept);
                //System.err.println("concept type = " + concept.getConceptType());
                String conceptType = concept.getConceptType().toString();
                int thisConceptBegin = concept.getBegin().getTokenOffset();
                int thisConceptEnd = concept.getEnd().getTokenOffset();
                if (concept.getBegin().getTokenOffset() < conceptBeginTokenOffset) {
                    trainingInstance.addFeature("concept_" + conceptType + "_left");
                    if ((conceptBeginTokenOffset - thisConceptEnd) < 4) {
                        trainingInstance.addFeature("concept_" + conceptType + "_left_3");
                    }
                } else {
View Full Code Here

      annotationsByType.put(AnnotationType.CONCEPT, i2b2ConceptList);
    }

    for (ApiConcept currentApiConcept : apiConceptList)
    {
      ConceptAnnotation c = new ConceptAnnotation();

      int beginCharacter = currentApiConcept.getBegin();
      int endCharacter = currentApiConcept.getEnd();

      // TODO FIX THIS!! Converter won't work with uima code!!!
      LineAndTokenPosition beginPosition = convertCharacterOffsetToLineToken(beginCharacter);
      LineAndTokenPosition endPosition = convertCharacterOffsetToLineToken(endCharacter);

      Location beginLocation = new Location();
      beginLocation.setLine(beginPosition.getLine());
      beginLocation.setTokenOffset(beginPosition.getTokenOffset());

      Location endLocation = new Location();
      endLocation.setLine(endPosition.getLine());
      endLocation.setTokenOffset(endPosition.getTokenOffset());

      c.setAnnotationFileLineNumber(beginPosition.getLine());
      c.setBegin(beginLocation);
      c.setEnd(endLocation);
      c.setConceptText(currentApiConcept.getText());
      String conceptType = currentApiConcept.getType();
      if (conceptType != null && !conceptType.isEmpty())
      {
        c.setConceptType(ConceptType.valueOf(conceptType));
      } else
      {
        c.setConceptType(null);
      }
     
      c.setEnclosingScopes(null);

      allAnnotationList.add(c);
      annotationsByType.get(AnnotationType.CONCEPT).add(c);
    }
  }
View Full Code Here

    String endLine = matcher.group(4);
    String endCharacter = matcher.group(5);
    String conceptTypeText = matcher.group(6);
//    System.out.format("    concept text: %s%n", conceptText);
//    System.out.format("    concept type text: %s%n", conceptTypeText);
    ConceptAnnotation a = new ConceptAnnotation();
    a.setConceptText(conceptText);
    a.setBegin(new Location(beginLine, beginCharacter));
    a.setEnd(new Location(endLine, endCharacter));
    a.setConceptType(ConceptType.valueOf(conceptTypeText.toUpperCase()));
//    System.out.format("    CONCEPT ANNOTATION OBJECT: %s%n", a);
//    System.out.format("    CONCEPT ANNOTATION OBJECT i2b2: %s%n", a.toI2B2String());
    return a;
  }
View Full Code Here

        if (annotationsAtCurrentPosition != null)
        for (Annotation a : annotationsAtCurrentPosition)
        {
            if (checkForEnabledFeature("concepts")) {
            if (a instanceof ConceptAnnotation) {
                ConceptAnnotation concept = (ConceptAnnotation) a;

                String conceptType = concept.getConceptType().toString();
                int thisConceptBegin = concept.getBegin().getTokenOffset();
                int thisConceptEnd = concept.getEnd().getTokenOffset();
                if (concept.getBegin().getTokenOffset() < conceptBeginTokenOffset) {
                    trainingInstance.addFeature("concept_" + conceptType + "_left");
                    if ((conceptBeginTokenOffset - thisConceptEnd) < 4) {
                        trainingInstance.addFeature("concept_" + conceptType + "_left_3");
                    }
                } else {
View Full Code Here

  public List<Annotation> buildAssertionsFromConcepts(List<Annotation> conceptList)
  {
    List<Annotation> assertionList = new ArrayList<Annotation>();
    for (Annotation a : conceptList)
    {
      ConceptAnnotation concept = (ConceptAnnotation)a;
      if (concept.getConceptType() == ConceptType.PROBLEM)
      {
        AssertionAnnotation assertion = new AssertionAnnotation();
        assertion.setAssertionValue(null);
        assertion.setBegin(concept.getBegin());
        assertion.setEnd(concept.getEnd());
        assertion.setConceptText(concept.getConceptText());
        assertion.setConceptType(concept.getConceptType());
        assertionList.add(assertion);
      }
    }
    return assertionList;
  }
View Full Code Here

      CharacterOffsetToLineTokenConverter converter = new CharacterOffsetToLineTokenConverterDefaultImpl(wholeText);

      LineAndTokenPosition startLineAndTokenPosition = converter.convert(startCharOffset);
      LineAndTokenPosition endLineAndTokenPosition = converter.convert(endCharOffset);

      ConceptAnnotation conceptAnnotation = new ConceptAnnotation();

      Location beginLocation = new Location();
      beginLocation.setLine(startLineAndTokenPosition.getLine());
      beginLocation.setTokenOffset(startLineAndTokenPosition.getTokenOffset());
      conceptAnnotation.setBegin(beginLocation);

      Location endLocation = new Location();
      endLocation.setLine(endLineAndTokenPosition.getLine());
      endLocation.setTokenOffset(endLineAndTokenPosition.getTokenOffset());
      conceptAnnotation.setEnd(endLocation);

      String conceptText = wholeText.substring(startCharOffset, endCharOffset+1);
      conceptAnnotation.setConceptText(conceptText);

      // todo: what should be used as the parameter to setConceptType???
      conceptAnnotation.setConceptType(ConceptType.valueOf(conceptType.toString()));

      conceptAnnotationList.add(conceptAnnotation);
    }
View Full Code Here

    // if we're continuing, this means we are umls (and we are not rxnorm)
   
    String tui = umlsConcept.getTui();
    //logger.info(String.format("tui: %s", tui));
   
    ConceptType conceptType = null;
    if (problemSet.contains(tui))
    {
      conceptType = ConceptType.PROBLEM;
    } else if (testSet.contains(tui))
    {
View Full Code Here

      concept.setOriginalEntityExternalId(annotation.getAddress());

      FSArray ontologyConceptArray = annotation
          .getOntologyConceptArr();

      ConceptType conceptType = ConceptLookup
          .lookupConceptType(ontologyConceptArray);

      //logger.info(String.format("got concept type: %s", conceptType));

      // now always generating a concept annotation whether or not the
      // conceptType is null (previously, we only generated a concept
      // annotation if the conceptType was not null)
      if (conceptType != null)
      {
        concept.setConceptType(conceptType.toString());
      }
      concept.addToIndexes();

      //logger.info("finished adding new Concept annotation. " + concept);
View Full Code Here

TOP

Related Classes of org.mitre.medfacts.i2b2.util.Location

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.