Package org.mitre.medfacts.i2b2.annotation

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


      {
        String message = String.format("problem accessing resource");
        throw new RuntimeException(message, e);
      }

      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);
      assertionDecoderConfiguration.setPosTagger(posTagger);

      Set<String> enabledFeatureIdSet = null;
      enabledFeatureIdSet = BatchRunner
          .loadEnabledFeaturesFromFile(enabledFeaturesFile);
      assertionDecoderConfiguration.setEnabledFeatureIdSet(enabledFeatureIdSet);

      JarafeMEDecoder assertionDecoder = null;
      assertionDecoder = new JarafeMEDecoder(assertionModelFile);
      assertionDecoderConfiguration.setAssertionDecoder(assertionDecoder);

      this.assertionDecoderConfiguration = assertionDecoderConfiguration;
  }
View Full Code Here


      {
        String message = String.format("problem accessing resource");
        throw new RuntimeException(message, e);
      }

      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);
      assertionDecoderConfiguration.setPosTagger(posTagger);

      Set<String> enabledFeatureIdSet = null;
      enabledFeatureIdSet = BatchRunner
          .loadEnabledFeaturesFromFile(enabledFeaturesFile);
      assertionDecoderConfiguration.setEnabledFeatureIdSet(enabledFeatureIdSet);

      JarafeMEDecoder assertionDecoder = null;
      assertionDecoder = new JarafeMEDecoder(assertionModelFile);
      assertionDecoderConfiguration.setAssertionDecoder(assertionDecoder);

      this.assertionDecoderConfiguration = assertionDecoderConfiguration;
  }
View Full Code Here

      {
        String message = String.format("problem accessing resource");
        throw new RuntimeException(message, e);
      }

      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);
      assertionDecoderConfiguration.setPosTagger(posTagger);

      Set<String> enabledFeatureIdSet = null;
      enabledFeatureIdSet = BatchRunner
          .loadEnabledFeaturesFromFile(enabledFeaturesFile);
      assertionDecoderConfiguration.setEnabledFeatureIdSet(enabledFeatureIdSet);

      JarafeMEDecoder assertionDecoder = null;
      assertionDecoder = new JarafeMEDecoder(assertionModelFile);
      assertionDecoderConfiguration.setAssertionDecoder(assertionDecoder);

      this.assertionDecoderConfiguration = assertionDecoderConfiguration;
  }
View Full Code Here

  public void execute()
  {
    logger.info("inside execute()");

    DirectoryLoader l = new DirectoryLoader();
    l.setDirectory(baseDirectory);
    l.setModel(model);
    l.setScopeParser(scopeParser);
    l.setEnabledFeatureIdSet(enabledFeatureIdSet);

    l.processDirectory();
  }
View Full Code Here

      LineTokenToCharacterOffsetConverter converter = new LineTokenToCharacterOffsetConverter(contents);
      AssertionFileProcessor assertionProcessor = new AssertionFileProcessor();
      List<Annotation> assertions = assertionProcessor.processAnnotationFile(assertionFile);

      JCas jcas = cas.getJCas();
      SingleDocumentProcessor p = new SingleDocumentProcessor();
      p.setContents(contents);
      p.preprocess();
      String [][] tokenArrays = p.getTokenArrays();
      jcas.setSofaDataString(contents, "");
      int sentNum = 0;
      int tokNum = 0;
      for (int i=0; i < tokenArrays.length; i++) {
        Sentence sent = new Sentence(jcas);
View Full Code Here

      LineTokenToCharacterOffsetConverter converter = new LineTokenToCharacterOffsetConverter(contents);
      AssertionFileProcessor assertionProcessor = new AssertionFileProcessor();
      List<Annotation> assertions = assertionProcessor.processAnnotationFile(assertionFile);

      JCas jcas = cas.getJCas();
      SingleDocumentProcessor p = new SingleDocumentProcessor();
      p.setContents(contents);
      p.preprocess();
      String [][] tokenArrays = p.getTokenArrays();
      jcas.setSofaDataString(contents, "");
      int sentNum = 0;
      int tokNum = 0;
      for (int i=0; i < tokenArrays.length; i++) {
        Sentence sent = new Sentence(jcas);
View Full Code Here

    SingleDocumentProcessorCtakes p = new SingleDocumentProcessorCtakes();
    p.setJcas(jcas);
    p.setAssertionDecoderConfiguration(assertionDecoderConfiguration);
    // p.setContents(tokenizedContents);
    p.setContents(contents);
    CharacterOffsetToLineTokenConverter converter = new CharacterOffsetToLineTokenConverterCtakesImpl(
        jcas);
    p.setConverter2(converter);
    for (ApiConcept apiConcept : apiConceptList)
    {
      //logger
View Full Code Here

    // LineTokenToCharacterOffsetConverter converter =
    // new LineTokenToCharacterOffsetConverter(contents);


    // SingleDocumentProcessor p = new SingleDocumentProcessor();
    SingleDocumentProcessorCtakes p = new SingleDocumentProcessorCtakes();
    p.setJcas(jcas);
    p.setAssertionDecoderConfiguration(assertionDecoderConfiguration);
    // p.setContents(tokenizedContents);
    p.setContents(contents);
    CharacterOffsetToLineTokenConverter converter = new CharacterOffsetToLineTokenConverterCtakesImpl(
        jcas);
    p.setConverter2(converter);
    for (ApiConcept apiConcept : apiConceptList)
    {
      //logger
      //    .info(String.format("dir loader concept: %s", apiConcept.toString()));
      p.addConcept(apiConcept);
    }

    logger
        .info("(logging statement) AssertionAnalysisEngine.process() BEFORE CALLING p.processSingleDocument()");

    p.processSingleDocument();

    logger
        .info("(logging statement) AssertionAnalysisEngine.process() AFTER CALLING p.processSingleDocument()");

    Map<Integer, String> assertionTypeMap = p.getAssertionTypeMap();
    //logger.info(String.format("    - done processing ..\"."));

    // Map<Integer, Annotation> annotationMap = generateAnnotationMap(jcas,
    // Concept.type);
    CasIndexer<Annotation> indexer = new CasIndexer<Annotation>(jcas, null);
View Full Code Here

    for (RunConfiguration currentRunConfiguration : runConfigurationList)
    {
      int size = currentRunConfiguration.getFileList().size();
      logger.info(String.format("====== BEGIN RUN # %d WITH %d FILES IN TRAINING SET =====", i, size));

      BatchRunner b = new BatchRunner();
      b.setMode(Mode.EVAL);

      ScopeParser scopeParser = new ScopeParser(scopeFile.getAbsolutePath(), cueFile.getAbsolutePath());
      b.setScopeParser(scopeParser);

      b.setBaseDirectoryString(baseDirectoryString);
      b.setTrainingDirectory(trainDirectory.getAbsolutePath());
      b.setDecodeDirectory(evalDirectory.getAbsolutePath());

      b.setFileNameSuffix(String.format("%03d", currentRunConfiguration.getFileList().size()));

      String featuresFileString = "featureFile11d_with_class";
      File featuresFile = new File(baseDirectory, featuresFileString);

      b.processEnabledFeaturesFile(featuresFile);

      b.setRunConfiguration(currentRunConfiguration);

      b.execute();

      logger.info(String.format("====== END RUN # %d WITH %d FILES IN TRAINING SET =====", i, size));
      i++;
    }
View Full Code Here

      for (int i = 0; i < runsElementResult.getLength(); i++)
      {
        Element currentRunsElement = (Element)runsElementResult.item(i);

        RunConfiguration runConfiguration = new RunConfiguration();
        runConfigurationList.add(runConfiguration);

        int runNumber = ((Double)runNumberXpathExpression.evaluate(currentRunsElement, XPathConstants.NUMBER)).intValue();
        logger.info(String.format("  (%d) RUN -- run number: %d", i, runNumber));

        NodeList fileElementNodeList = (NodeList)runFileXpathExpression.evaluate(currentRunsElement, XPathConstants.NODESET);
        for (int j=0; j < fileElementNodeList.getLength(); j++)
        {
          Element fileElement = (Element)fileElementNodeList.item(j);

          String filename = fileNameExpression.evaluate(fileElement);
          File file = new File(filename);
          //logger.info(String.format("    - %s", filename));

          runConfiguration.addFile(file);
        }
      }
      logger.info("=== RUNS end ===");

      return runConfigurationList;
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.