Package org.mitre.medfacts.i2b2.annotation

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


          endToken = textLookup[i].length - 1;
        }

        ZoneAnnotation zone = new ZoneAnnotation();
        zone.setZoneName(currentRange.getLabel());
        Location begin = new Location();
        begin.setLine(i);
        begin.setTokenOffset(beginToken);
        zone.setBegin(begin);
        Location end = new Location();
        end.setLine(i);
        end.setTokenOffset(endToken);
        zone.setEnd(end);

//        allAnnotationList.add(zone);
//        List<Annotation> zoneAnnotationList = annotationsByType.get(AnnotationType.ZONE);
//        if (zoneAnnotationList == null)
View Full Code Here


    //logger.info("#####");
    //logger.info("#####");
    for (Annotation currentAnnotation : getAllAnnotationList())
    {
      //logger.info(String.format(" - %s%n", currentAnnotation));
      Location begin = currentAnnotation.getBegin();
      Location end = currentAnnotation.getEnd();
      //logger.info(String.format("==%n  begin: %s%n  end: %s%n==%n", begin, end));

      String targetText = extractTargetText(getTextLookup(), begin, end);

//      logger.info(String.format("    ANNOT: %s%n", currentAnnotation));
View Full Code Here

        //  trainingInstance.addFeature(conceptHeadFeature);
        //}
      }


      Location conceptBeginLocation = currentAssertionAnnotation.getBegin();
      int conceptBeginLine = conceptBeginLocation.getLine();
      int conceptBeginTokenOffset = conceptBeginLocation.getTokenOffset();
      Location conceptEndLocation = currentAssertionAnnotation.getEnd();
      int conceptEndTokenOffset = conceptEndLocation.getTokenOffset();
      String currentLine[] = textLookup[conceptBeginLine-1];

      if (checkForEnabledFeature("conceptUnigrams")) {
          for (int k = conceptBeginTokenOffset; k <= conceptEndTokenOffset; k++) {
              trainingInstance.addFeature("concept_unigram_" + StringHandling.escapeStringForFeatureName(currentLine[k]));
View Full Code Here

    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
View Full Code Here

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

          {
            logger.finest(String.format("MATCHES!!!%n  BEGIN MATCH%n  cue: %s%n  inputLine: %s%n  position: %d%n  END MATCH%n%n", cueItem.toString(), convertLineToString(currentLine), tokenOffset));
            CueWordAnnotation a = new CueWordAnnotation();
            int beginOffset = tokenOffset;
            int endOffset = tokenOffset + size - 1;
            Location beginLocation = new Location();
            beginLocation.setLine(lineNumberOffset + 1);
            beginLocation.setTokenOffset(beginOffset);
            Location endLocation = new Location();
            endLocation.setLine(lineNumberOffset + 1);
            endLocation.setTokenOffset(endOffset);
            a.setBegin(beginLocation);
            a.setEnd(endLocation);
            a.setCueWordType(getCueWordType());
            a.setCueWordClass(cueItem.getCueWordClass());
            a.setCueWordText(constructWordSequenceText(currentLine, beginOffset, endOffset));
View Full Code Here

    // public void hello() {}

     @Test
     public void testRandomAssignmentSystemSimple()
     {
       RandomAssignmentSystem system = new RandomAssignmentSystem();
       system.setTrainingRatio(0.8f);

       for (int i=0; i < 10; i++)
       {
         system.addItem(i);
       }

       system.createSets();

       Set<RandomAssignmentItem> trainingSet = system.getTrainingSetSorted();
       Set<RandomAssignmentItem> testSet = system.getTestSetSorted();

       System.out.println("=== TRAINING SET begin ===");
       printoutSet(trainingSet);
       System.out.println("=== TRAINING SET begin ===");
       System.out.println();
View Full Code Here

  }

  public void createTrainingSplit()
  {
    List<TrainingInstance> masterTrainingList = getMasterTrainingInstanceListTraining();
    RandomAssignmentSystem system = new RandomAssignmentSystem();
    system.setTrainingRatio(0.8f);

    system.addZeroInclusiveToNExclusive(masterTrainingList.size());

    for (int i=0; i < 10; i++)
    {
      system.addItem(i);
    }

    system.createSets();

    Set<Integer> trainingSet = system.getTrainingPositions();
    Set<Integer> testSet = system.getTestPositions();

    trainingSplitList = new ArrayList<TrainingInstance>();
    testSplitList = new ArrayList<TrainingInstance>();

    for (int i : trainingSet)
View Full Code Here

TOP

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

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.