AnalysisEngine sectionAnnotator = AnalysisEngineFactory
.createPrimitive(CDASegmentAnnotator.class, typeSystem);
AnalysisEngine dumpOutput = AnalysisEngineFactory.createPrimitive(
DumpOutputAE.class, typeSystem);
// SimplePipeline.runPipeline(reader, sectionAnnotator, dumpOutput);
JCasIterable casIter = new JCasIterable(reader, sectionAnnotator,
dumpOutput);
final String expected_hpi_section = "2.16.840.1.113883.10.20.22.2.20";
final int expected_begin = 1634;
final int expected_end = 1696;
boolean section_exists = false;
int section_begin = 0;
int section_end = 0;
while (casIter.hasNext()) {
JCas jCas = casIter.next();
for (Segment segment : JCasUtil.select(jCas, Segment.class)) {
if (expected_hpi_section.equalsIgnoreCase(segment.getId())) {
section_exists = true;
section_begin = segment.getBegin();
section_end = segment.getEnd();