Package org.mitre.medfacts.i2b2.annotation

Examples of org.mitre.medfacts.i2b2.annotation.CueWordType


      ScopeParser scopeParser = new ScopeParser(scopeModelFilePath,
          cueModelFilePath);
      assertionDecoderConfiguration.setScopeParser(scopeParser);

      logger.info(String.format("pos model file: %s", posModelFilePath));
      PartOfSpeechTagger posTagger = new PartOfSpeechTagger(posModelFilePath);
      assertionDecoderConfiguration.setPosTagger(posTagger);

      Set<String> enabledFeatureIdSet = null;
      enabledFeatureIdSet = BatchRunner
          .loadEnabledFeaturesFromFile(enabledFeaturesFile);
View Full Code Here


    String otherBeginLine = matcher.group(8);
    String otherBeginCharacter = matcher.group(9);
    String otherEndLine = matcher.group(10);
    String otherEndCharacter = matcher.group(11);

    RelationAnnotation a = new RelationAnnotation();
    a.setConceptText(conceptText);
    a.setBegin(new Location(beginLine, beginCharacter));
    a.setEnd(new Location(endLine, endCharacter));
    a.setRelationType(RelationType.valueOf(relationTypeText.toUpperCase()));
    a.setOtherConceptText(otherConceptText);
    a.setOtherConceptBegin(new Location(otherBeginLine, otherBeginCharacter));
    a.setOtherConceptEnd(new Location(otherEndLine, otherEndCharacter));

//    System.out.format("    RELATION ANNOTATION OBJECT: %s%n", a);
//    System.out.format("    RELATION ANNOTATION OBJECT i2b2: %s%n", a.toI2B2String());
    return a;
  }
View Full Code Here

    {
      case XCOPE:
        String scopeIdString = matcher.group(9);
        int scopeId = Integer.parseInt(scopeIdString);

        ScopeAnnotation a1 = new ScopeAnnotation();
        a1.setScopeId(scopeId);

        annotation = a1;
        break;
      case CUE:
        String cueSubTypeString = matcher.group(11);
View Full Code Here

            }
            }

          if (a instanceof ScopeAnnotation)
          {
            ScopeAnnotation scope = (ScopeAnnotation)a;
            scopeCount++;
            if (checkForEnabledFeature("scope"))
            {
              trainingInstance.addFeature("scope");
            }
            if (checkForEnabledFeature("inScope"))
            {
              trainingInstance.addFeature("in_scope_" + currentToken);
            }
            if (checkForEnabledFeature("inScopeId"))
            {
              trainingInstance.addFeature("in_scope_id_" + scope.getScopeId() + "_" + currentToken);
            }
          }

          if (a instanceof CueAnnotation)
          {
View Full Code Here

            }
            }

          if (a instanceof ScopeAnnotation)
          {
            ScopeAnnotation scope = (ScopeAnnotation)a;
            scopeCount++;
            if (checkForEnabledFeature("scope"))
            {
              trainingInstance.addFeature("scope");
            }
            if (checkForEnabledFeature("inScope"))
            {
              trainingInstance.addFeature("in_scope_" + currentToken);
            }
            if (checkForEnabledFeature("inScopeId"))
            {
              trainingInstance.addFeature("in_scope_id_" + scope.getScopeId() + "_" + currentToken);
            }
          }

          if (a instanceof CueAnnotation)
          {
View Full Code Here

    for (Annotation current : scopeFileAnnotationList)
    {
        if (current instanceof ScopeAnnotation)
        {
            ScopeAnnotation scope = (ScopeAnnotation)current;
            int scopeId = scope.getScopeId();
            scopeIdMap.put(scopeId, scope);
        } else if (current instanceof CueAnnotation)
        {
            CueAnnotation cue = (CueAnnotation)current;
            int scopeIdForThisCue = cue.getScopeIdReference();
            cueForScopeIdMap.put(scopeIdForThisCue, cue);
        }
    }

    for (Entry<Integer, ScopeAnnotation> current : scopeIdMap.entrySet())
    {
        int currentId = current.getKey();
        ScopeAnnotation scope = current.getValue();

        CueAnnotation cue = cueForScopeIdMap.get(currentId);
        scope.setCueForScope(cue);
    }
    //For testing -Alex Yeh
//    logger.info(String.format("CUES for SCOPES in FILE %s%n", textFilename);
//    logger.info(String.format("  MAP size: %s.%n", scopeIdMap.entrySet().size());
//    for (Entry<Integer, ScopeAnnotation> current : scopeIdMap.entrySet())
//    {
//        ScopeAnnotation scope = current.getValue();
//        logger.info(String.format("  Scope: %s%n    => Cue: %s%n", scope.toString(), scope.getCueForScope().toString());
//    }

    //Find enclosing scopes for each assertion annotation
    //List<Annotation> assertionFileAnnotationList = annotationsByType.get(AnnotationType.ASSERTION);
    List<Annotation> assertionFileAnnotationList = assertionList;

//    logger.info(String.format("ASSERTIONS for FILE %s%n", textFilename); //For testing
    for (Annotation current : assertionFileAnnotationList)
    {
      Location annotationBegin = current.getBegin();
      int beginLine = annotationBegin.getLine();
      int beginTokenOffset = annotationBegin.getTokenOffset();
      Location annotationEnd = current.getEnd();
      // Assume that 'annotationEnd.getLine()' will return the same line number as 'beginLine'
      int endTokenOffset = annotationEnd.getTokenOffset();
      List<Annotation> annotationsForFirstToken = indexer.findAnnotationsForPosition(beginLine, beginTokenOffset);
      List<ScopeAnnotation> enclosingScopesFound = new ArrayList<ScopeAnnotation>();
      AssertionAnnotation assertion = (AssertionAnnotation)current;

//      logger.info(String.format("   ASRT: %s => %s annotations for 1st token%n", assertion.toString(), annotationsForFirstToken.size()); //for testing
      for (Annotation annotationForFirstToken : annotationsForFirstToken)
      {
        if ((annotationForFirstToken instanceof ScopeAnnotation) &&
                (endTokenOffset <= annotationForFirstToken.getEnd().getTokenOffset()))
        {
          //This annotation containing the first token of the current assertion annotation
          // is a ScopeAnnotation that contains all the tokens of the current assertion annotation.
          //Add it to the list of enclosing scopes.
          ScopeAnnotation scope = (ScopeAnnotation)annotationForFirstToken;
          enclosingScopesFound.add(scope);
        }
      }
      assertion.setEnclosingScopes(enclosingScopesFound);
    }
View Full Code Here

    String endLine = matcher.group(4);
    String endCharacter = matcher.group(5);
    String scopeTypeText = matcher.group(6);
    ScopeType scopeType = ScopeType.valueOf(scopeTypeText.toUpperCase());

    ScopeOrCueAnnotation annotation = null;

    switch (scopeType)
    {
      case XCOPE:
        String scopeIdString = matcher.group(9);
        int scopeId = Integer.parseInt(scopeIdString);

        ScopeAnnotation a1 = new ScopeAnnotation();
        a1.setScopeId(scopeId);

        annotation = a1;
        break;
      case CUE:
        String cueSubTypeString = matcher.group(11);
        CueSubType cueSubType = CueSubType.valueOf(cueSubTypeString.toUpperCase());
        String scopeRefString = matcher.group(12);
        int scopeRef = Integer.parseInt(scopeRefString);

        CueAnnotation a2 = new CueAnnotation();
        a2.setCueSubType(cueSubType);
        a2.setScopeIdReference(scopeRef);
        annotation = a2;
        break;
    }
    annotation.setConceptText(conceptText);
    annotation.setBegin(new Location(beginLine, beginCharacter));
    annotation.setEnd(new Location(endLine, endCharacter));
    annotation.setScopeType(scopeType);


//    System.out.format("    SCOPE ANNOTATION OBJECT: %s%n", annotation);
//    System.out.format("    SCOPE ANNOTATION OBJECT i2b2: %s%n", annotation.toI2B2String());
    return annotation;
View Full Code Here

      AssertionDecoderConfiguration assertionDecoderConfiguration = new AssertionDecoderConfiguration();

      logger.info(String.format("scope model file: %s", scopeModelFilePath));
      logger.info(String.format("cue model file: %s", cueModelFilePath));
      ScopeParser scopeParser = new ScopeParser(scopeModelFilePath,
          cueModelFilePath);
      assertionDecoderConfiguration.setScopeParser(scopeParser);

      logger.info(String.format("pos model file: %s", posModelFilePath));
      PartOfSpeechTagger posTagger = new PartOfSpeechTagger(posModelFilePath);
View Full Code Here

      AssertionDecoderConfiguration assertionDecoderConfiguration = new AssertionDecoderConfiguration();

      logger.info(String.format("scope model file: %s", scopeModelFilePath));
      logger.info(String.format("cue model file: %s", cueModelFilePath));
      ScopeParser scopeParser = new ScopeParser(scopeModelFilePath,
          cueModelFilePath);
      assertionDecoderConfiguration.setScopeParser(scopeParser);

      logger.info(String.format("pos model file: %s", posModelFilePath));
      PartOfSpeechTagger posTagger = new PartOfSpeechTagger(posModelFilePath);
View Full Code Here

    {
      cueModelFile = new File(baseDir, cueModelFileName);
    }
    System.out.format("cue model file: %s%n", cueModelFile.getAbsolutePath());
    //initialize scope/cue parser
    ScopeParser scopeParser = new ScopeParser(scopeModelFile.getAbsolutePath(), cueModelFile.getAbsolutePath());


    ApiDecoderExample example = new ApiDecoderExample();
    example.setModel(modelValue);
    example.setBaseDirectory(baseDirectory);
View Full Code Here

TOP

Related Classes of org.mitre.medfacts.i2b2.annotation.CueWordType

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.