Package org.apache.ctakes.assertion.medfacts.types

Examples of org.apache.ctakes.assertion.medfacts.types.Concept


      String conceptText = annotation.getCoveredText();

      //logger.info(String.format("NAMED ENTITY: \"%s\" [%d-%d]", conceptText,
      //    begin, end));

      Concept concept = new Concept(jcas, begin, end);
      concept.setConceptText(conceptText);
      concept.setConceptType(null);

      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);

    }
    //logger.info("    after iterating over named entities.");
View Full Code Here


        .getAnnotationIndex(conceptType);

    ArrayList<ApiConcept> apiConceptList = new ArrayList<ApiConcept>();
    for (Annotation annotation : conceptAnnotationIndex)
    {
      Concept conceptAnnotation = (Concept) annotation;

      ApiConcept apiConcept = new ApiConcept();
      int begin = conceptAnnotation.getBegin();
      int end = conceptAnnotation.getEnd();
      String conceptText = contents.substring(begin, end);

      apiConcept.setBegin(begin);
      apiConcept.setEnd(end);
      apiConcept.setText(conceptText);
      apiConcept.setType(conceptAnnotation.getConceptType());
      apiConcept.setExternalId(conceptAnnotation.getAddress());

      apiConceptList.add(apiConcept);
    }

    // String conceptFilePath =
    // currentTextFile.getAbsolutePath().replaceFirst("\\.txt$", ".con");
    // File conceptFile = new File(conceptFilePath);
    // logger.info(String.format("    - using concept file \"%s\"...",
    // conceptFile.getName()));
    // String conceptFileContents =
    // StringHandling.readEntireContents(conceptFile);
    // //List<Concept> parseConceptFileContents(conceptFileContents);
    //
    // LineTokenToCharacterOffsetConverter converter =
    // new LineTokenToCharacterOffsetConverter(contents);
    //
    // List<ApiConcept> apiConceptList = parseConceptFile(conceptFile, contents,
    // converter);

    // 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
        .debug("(logging statement) AssertionAnalysisEngine.process() BEFORE CALLING p.processSingleDocument()");

    p.processSingleDocument();

    logger
        .debug("(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);

    //logger.info("assertionTypeMap loop OUTSIDE BEFORE...");
    for (Entry<Integer, String> current : assertionTypeMap.entrySet())
    {
      //logger.info("    assertionTypeMap loop INSIDE BEGIN");
      String currentAssertionType = current.getValue();
      //logger.info(String.format("  currentAssertionType: %s",
      //    currentAssertionType));
      Integer currentIndex = current.getKey();
      ApiConcept originalConcept = apiConceptList.get(currentIndex);

      Concept associatedConcept = (Concept) indexer
          .lookupByAddress(originalConcept.getExternalId());
      int entityAddress = associatedConcept.getOriginalEntityExternalId();
      IdentifiedAnnotation annotation = (IdentifiedAnnotation) indexer
          .lookupByAddress(entityAddress);

      // possible values for currentAssertionType:
      // present
View Full Code Here

      String conceptText = annotation.getCoveredText();

      //logger.info(String.format("NAMED ENTITY: \"%s\" [%d-%d]", conceptText,
      //    begin, end));

      Concept concept = new Concept(jcas, begin, end);
      concept.setConceptText(conceptText);
      concept.setConceptType(null);

      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);

    }
    //logger.info("    after iterating over named entities.");
View Full Code Here

        .getAnnotationIndex(conceptType);

    ArrayList<ApiConcept> apiConceptList = new ArrayList<ApiConcept>();
    for (Annotation annotation : conceptAnnotationIndex)
    {
      Concept conceptAnnotation = (Concept) annotation;

      ApiConcept apiConcept = new ApiConcept();
      int begin = conceptAnnotation.getBegin();
      int end = conceptAnnotation.getEnd();
      String conceptText = contents.substring(begin, end);

      apiConcept.setBegin(begin);
      apiConcept.setEnd(end);
      apiConcept.setText(conceptText);
      apiConcept.setType(conceptAnnotation.getConceptType());
      apiConcept.setExternalId(conceptAnnotation.getAddress());

      apiConceptList.add(apiConcept);
    }

    // String conceptFilePath =
    // currentTextFile.getAbsolutePath().replaceFirst("\\.txt$", ".con");
    // File conceptFile = new File(conceptFilePath);
    // logger.info(String.format("    - using concept file \"%s\"...",
    // conceptFile.getName()));
    // String conceptFileContents =
    // StringHandling.readEntireContents(conceptFile);
    // //List<Concept> parseConceptFileContents(conceptFileContents);
    //
    // LineTokenToCharacterOffsetConverter converter =
    // new LineTokenToCharacterOffsetConverter(contents);
    //
    // List<ApiConcept> apiConceptList = parseConceptFile(conceptFile, contents,
    // converter);

    // 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);

    //logger.info("assertionTypeMap loop OUTSIDE BEFORE...");
    for (Entry<Integer, String> current : assertionTypeMap.entrySet())
    {
      //logger.info("    assertionTypeMap loop INSIDE BEGIN");
      String currentAssertionType = current.getValue();
      //logger.info(String.format("  currentAssertionType: %s",
      //    currentAssertionType));
      Integer currentIndex = current.getKey();
      ApiConcept originalConcept = apiConceptList.get(currentIndex);

      Concept associatedConcept = (Concept) indexer
          .lookupByAddress(originalConcept.getExternalId());
      int entityAddress = associatedConcept.getOriginalEntityExternalId();
      IdentifiedAnnotation annotation = (IdentifiedAnnotation) indexer
          .lookupByAddress(entityAddress);

      // possible values for currentAssertionType:
      // present
View Full Code Here

TOP

Related Classes of org.apache.ctakes.assertion.medfacts.types.Concept

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.