Package org.mitre.medfacts.zoner

Examples of org.mitre.medfacts.zoner.ZonerCli


    } catch (URISyntaxException e1)
    {
      logger.error( String.format("section regex file not found [%s]", sectionRegexFileUriString), e1);
      throw new AnalysisEngineProcessException(e1);
    }
    ZonerCli zonerCli =
      new ZonerCli(sectionRegexFileInClasspathUri);
   
    zonerCli.setEntireContents(jcas.getDocumentText());
    // initialize converter once contents are set
    zonerCli.initialize();
    try {
      zonerCli.execute();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      return;
      //throw new AnalysisEngineProcessException(e);
    } catch (StringIndexOutOfBoundsException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      System.out.format("string index out of bounds exception count: %d%n", ++countOfIndexOutOfBounds);
      return;
      //throw new AnalysisEngineProcessException(e);
    }
    // Add the zone annotations
    List<Range> rangeList = zonerCli.getRangeList();
    for (Iterator<Range> i = rangeList.iterator(); i.hasNext()) {
      Range r = i.next();
        Zone zAnnot = new Zone(jcas)
        zAnnot.setBegin(r.getBegin());
        zAnnot.setEnd(r.getEnd());
        zAnnot.setLabel(r.getLabel());
        zAnnot.addToIndexes();
        logger.info(String.format("added new zone annotation [%d-%d] \"%s\"", zAnnot.getBegin(), zAnnot.getEnd(), zAnnot.getCoveredText()));
    }
   
//    List<Range> subsectionRangeList = zonerCli.getSubsections();
//    for (Iterator<Range> i = subsectionRangeList.iterator(); i.hasNext();  ) {
//      Range r = i.next();
//        Subzone sAnnot = new Subzone(jcas); 
//        sAnnot.setBegin(r.getBegin());
//        sAnnot.setEnd(r.getEnd());
//        sAnnot.setLabel(r.getLabel());
//        sAnnot.addToIndexes();
//        logger.info(String.format("added new subzone annotation [%d-%d] \"%s\"", sAnnot.getBegin(), sAnnot.getEnd(), sAnnot.getCoveredText()));
//    }
   
   
   
    // Add the heading annotations
    List<HeadingRange> headings = zonerCli.getHeadings();
    for (Iterator<HeadingRange> i = headings.iterator(); i.hasNext()) {
      HeadingRange r = i.next();
        Heading hAnnot = new Heading(jcas)
        hAnnot.setBegin(r.getHeadingBegin());
        hAnnot.setEnd(r.getHeadingEnd());
View Full Code Here


    } catch (URISyntaxException e1)
    {
      logger.log(Level.SEVERE, String.format("section regex file not found [%s]", sectionRegexFileUriString), e1);
      throw new AnalysisEngineProcessException(e1);
    }
    ZonerCli zonerCli =
      new ZonerCli(sectionRegexFileInClasspathUri);
   
    zonerCli.setEntireContents(jcas.getDocumentText());
    // initialize converter once contents are set
    zonerCli.initialize();
    try {
      zonerCli.execute();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      return;
      //throw new AnalysisEngineProcessException(e);
    } catch (StringIndexOutOfBoundsException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      System.out.format("string index out of bounds exception count: %d%n", ++countOfIndexOutOfBounds);
      return;
      //throw new AnalysisEngineProcessException(e);
    }
    // Add the zone annotations
    List<Range> rangeList = zonerCli.getRangeList();
    for (Iterator<Range> i = rangeList.iterator(); i.hasNext()) {
      Range r = i.next();
        Zone zAnnot = new Zone(jcas)
        zAnnot.setBegin(r.getBegin());
        zAnnot.setEnd(r.getEnd());
        zAnnot.setLabel(r.getLabel());
        zAnnot.addToIndexes();
        logger.info(String.format("added new zone annotation [%d-%d] \"%s\"", zAnnot.getBegin(), zAnnot.getEnd(), zAnnot.getCoveredText()));
    }
   
//    List<Range> subsectionRangeList = zonerCli.getSubsections();
//    for (Iterator<Range> i = subsectionRangeList.iterator(); i.hasNext();  ) {
//      Range r = i.next();
//        Subzone sAnnot = new Subzone(jcas); 
//        sAnnot.setBegin(r.getBegin());
//        sAnnot.setEnd(r.getEnd());
//        sAnnot.setLabel(r.getLabel());
//        sAnnot.addToIndexes();
//        logger.info(String.format("added new subzone annotation [%d-%d] \"%s\"", sAnnot.getBegin(), sAnnot.getEnd(), sAnnot.getCoveredText()));
//    }
   
   
   
    // Add the heading annotations
    List<HeadingRange> headings = zonerCli.getHeadings();
    for (Iterator<HeadingRange> i = headings.iterator(); i.hasNext()) {
      HeadingRange r = i.next();
        Heading hAnnot = new Heading(jcas)
        hAnnot.setBegin(r.getHeadingBegin());
        hAnnot.setEnd(r.getHeadingEnd());
View Full Code Here

    } catch (URISyntaxException e1)
    {
      logger.error( String.format("section regex file not found [%s]", sectionRegexFileUriString), e1);
      throw new AnalysisEngineProcessException(e1);
    }
    ZonerCli zonerCli =
      new ZonerCli(sectionRegexFileInClasspathUri);
   
    zonerCli.setEntireContents(jcas.getDocumentText());
    // initialize converter once contents are set
    zonerCli.initialize();
    try {
      zonerCli.execute();
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      return;
      //throw new AnalysisEngineProcessException(e);
    } catch (StringIndexOutOfBoundsException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      System.out.format("string index out of bounds exception count: %d%n", ++countOfIndexOutOfBounds);
      return;
      //throw new AnalysisEngineProcessException(e);
    }
    // Add the zone annotations
    List<Range> rangeList = zonerCli.getRangeList();
    for (Iterator<Range> i = rangeList.iterator(); i.hasNext()) {
      Range r = i.next();
        Zone zAnnot = new Zone(jcas)
        zAnnot.setBegin(r.getBegin());
        zAnnot.setEnd(r.getEnd());
        zAnnot.setLabel(r.getLabel());
        zAnnot.addToIndexes();
        logger.info(String.format("added new zone annotation [%d-%d] \"%s\"", zAnnot.getBegin(), zAnnot.getEnd(), zAnnot.getCoveredText()));
    }
   
//    List<Range> subsectionRangeList = zonerCli.getSubsections();
//    for (Iterator<Range> i = subsectionRangeList.iterator(); i.hasNext();  ) {
//      Range r = i.next();
//        Subzone sAnnot = new Subzone(jcas); 
//        sAnnot.setBegin(r.getBegin());
//        sAnnot.setEnd(r.getEnd());
//        sAnnot.setLabel(r.getLabel());
//        sAnnot.addToIndexes();
//        logger.info(String.format("added new subzone annotation [%d-%d] \"%s\"", sAnnot.getBegin(), sAnnot.getEnd(), sAnnot.getCoveredText()));
//    }
   
   
   
    // Add the heading annotations
    List<HeadingRange> headings = zonerCli.getHeadings();
    for (Iterator<HeadingRange> i = headings.iterator(); i.hasNext()) {
      HeadingRange r = i.next();
        Heading hAnnot = new Heading(jcas)
        hAnnot.setBegin(r.getHeadingBegin());
        hAnnot.setEnd(r.getHeadingEnd());
View Full Code Here

  }

  public static List<ZoneAnnotation> findZones(String entireContents, String textLookup[][], CharacterOffsetToLineTokenConverter converter)
  {
    ZonerCli zoner = new ZonerCli();
    zoner.setConverter(converter);
    zoner.setEntireContents(entireContents);
    zoner.findHeadings();
    List<Range> zonerRangeList = zoner.getFullRangeListAdjusted();

    ArrayList<ZoneAnnotation> tempZoneAnnotationList =
        new ArrayList<ZoneAnnotation>();

    for (Range currentRange : zonerRangeList)
View Full Code Here

TOP

Related Classes of org.mitre.medfacts.zoner.ZonerCli

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.