Package org.mitre.medfacts.i2b2.util

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


{

  @Test
  public void testGenerateCombinations()
  {
    CombinationGenerator g = new CombinationGenerator();
    int inputSize = 4;
    List<Set<Integer>> combinations = g.generateCombinations(inputSize);


    int expectedSize = g.twoToThePowerOf(inputSize) - 1;
    int actualSize = combinations.size();
    assertEquals(String.format("number of combinations for an input size of %d should be %d instead of %d", inputSize, expectedSize, actualSize), expectedSize, actualSize);
  }
View Full Code Here


  @Ignore
  @Test
  public void testTwoToThePowerOf()
  {
    CombinationGenerator g = new CombinationGenerator();

    int input = 0;
    int expectedOutput = 1;
    int actualOutput = g.twoToThePowerOf(input);

    assertEquals(String.format("2 to the %d should equal %d; actual value was %d", input, expectedOutput, actualOutput), expectedOutput, actualOutput);


    input = 1;
    expectedOutput = 2;
    actualOutput = g.twoToThePowerOf(input);

    assertEquals(String.format("2 to the %d should equal %d; actual value was %d", input, expectedOutput, actualOutput), expectedOutput, actualOutput);

    input = 2;
    expectedOutput = 4;
    actualOutput = g.twoToThePowerOf(input);

    assertEquals(String.format("2 to the %d should equal %d; actual value was %d", input, expectedOutput, actualOutput), expectedOutput, actualOutput);

    input = 3;
    expectedOutput = 8;
    actualOutput = g.twoToThePowerOf(input);

    assertEquals(String.format("2 to the %d should equal %d; actual value was %d", input, expectedOutput, actualOutput), expectedOutput, actualOutput);

    input = 4;
    expectedOutput = 16;
    actualOutput = g.twoToThePowerOf(input);

    assertEquals(String.format("2 to the %d should equal %d; actual value was %d", input, expectedOutput, actualOutput), expectedOutput, actualOutput);

  }
View Full Code Here

      }
      List<String> posTags = posTagger.processStringList(lineStr);
      int c = 0;
      for (String tag : posTags) {
  PartOfSpeechAnnotation posAn = new PartOfSpeechAnnotation();
  posAn.setBegin(new Location(i, c));
  posAn.setEnd(new Location(i, c));
  posAn.setPartOfSpeech(tag);
  posList.add(posAn);
  c += 1;
      }
    }
View Full Code Here

            String typ = an.typ().labelHead();
            int lineNum = Integer.parseInt(an.vl().get());
            if (typ.equals("xcope")) {
                ScopeAnnotation s = new ScopeAnnotation();
                s.setScopeId(a.i());
                s.setBegin(new Location(lineNum,an.st()));
                s.setEnd(new Location(lineNum,an.en()));
                annots.add(s);
            } else if (typ.equals("cue")) {
                CueAnnotation c = new CueAnnotation();
                String st = an.typ().assoc("type");
                if (st.equals("negation"))
                    c.setCueSubType(CueSubType.NEGATION);
                else
                    c.setCueSubType(CueSubType.SPECULATION);
                c.setBegin(new Location(lineNum,an.st()));
                c.setEnd(new Location(lineNum,an.en()));
                c.setScopeIdReference(a.i());
                annots.add(c);
            }
        }
        return annots;
View Full Code Here

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

    String assertionValue = matcher.group(7);
//    System.out.format("    concept text: %s%n", conceptText);
//    System.out.format("    concept type text: %s%n", conceptTypeText);
    AssertionAnnotation a = new AssertionAnnotation();
    a.setConceptText(conceptText);
    a.setBegin(new Location(beginLine, beginCharacter));
    a.setEnd(new Location(endLine, endCharacter));
    a.setConceptType(ConceptType.valueOf(conceptTypeText.toUpperCase()));
    a.setAssertionValue(AssertionValue.valueOf(assertionValue.toUpperCase()));
//    System.out.format("    ASSERTION ANNOTATION OBJECT: %s%n", a);
//    System.out.format("    ASSERTION ANNOTATION OBJECT i2b2: %s%n", a.toI2B2String());
    return a;
View Full Code Here

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

    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

    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

      logger.info("    BEGIN CONCEPTS");
      for (Annotation currentAnnotation : conceptAnnotations)
      {
        logger.info(String.format("    CONCEPT: %s", currentAnnotation));
        Location beginLineToken = currentAnnotation.getBegin();
        Location endLineToken = currentAnnotation.getEnd();

        Integer beginCharacter = converter.convert(convertPositionToZonerLineAndTokenPosition(beginLineToken)).getBegin();
        Integer endCharacter = converter.convert(convertPositionToZonerLineAndTokenPosition(endLineToken)).getEnd();

        String text =  contents.substring(beginCharacter, endCharacter + 1);
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.