@Test public void testSentenceDetection() throws UIMAException, IOException { String text = "Dr. Doolitle asked patient\nto take a deep breath\nand exhale slowly. Patient coughed."; AggregateBuilder builder = new AggregateBuilder(); File directoryCtakes = new File("../ctakes-core/desc/analysis_engine"); File fileCtakes = new File(directoryCtakes, "TokenizerAnnotator.xml"); XMLParser parser = UIMAFramework.getXMLParser(); XMLInputSource source = new XMLInputSource(fileCtakes); builder.add(parser.parseAnalysisEngineDescription(source)); File directory = new File("desc/analysis_engine"); File file = new File(directory, "SentenceDetectorAnnotator.xml"); source = new XMLInputSource(file); builder.add(parser.parseAnalysisEngineDescription(source)); AnalysisEngine engine = builder.createAggregate(); JCas jCas = engine.newJCas(); jCas.setDocumentText(text); Segment s = new Segment(jCas); s.setBegin(0); s.setEnd(text.length()); s.setId("DEFAULT"); s.addToIndexes(); engine.process(jCas); AnnotationIndex<Annotation> sentences = jCas.getAnnotationIndex(Sentence.type); Iterator<Annotation> iter =sentences.iterator(); int sentCount = 0; while(iter.hasNext()) { Sentence sent = (Sentence)iter.next(); System.out.println("[" + sent.getCoveredText() + "]"); sentCount ++; } Assert.assertTrue(sentCount == 2); }
public void process(JCas jcas) throws AnalysisEngineProcessException { logger.info("Starting processing."); sentenceCount = 0; String text = jcas.getDocumentText(); JFSIndexRepository indexes = jcas.getJFSIndexRepository(); Iterator<?> sectionItr = indexes.getAnnotationIndex(Segment.type) .iterator(); while (sectionItr.hasNext()) { Segment sa = (Segment) sectionItr.next(); String sectionID = sa.getId(); if (!skipSegmentsSet.contains(sectionID)) { sentenceCount = annotateParagraph(jcas, text, sa.getBegin(), sa.getEnd(), sentenceCount); } } }
SentenceDetector extends JCasAnnotator_ImplBase { public void process(JCas jcas) throws AnalysisEngineProcessException { logger.info("Starting processing."); sentenceCount = 0; String text = jcas.getDocumentText(); JFSIndexRepository indexes = jcas.getJFSIndexRepository(); Iterator<?> sectionItr = indexes.getAnnotationIndex(Segment.type) .iterator(); while (sectionItr.hasNext()) { Segment sa = (Segment) sectionItr.next(); String sectionID = sa.getId(); if (!skipSegmentsSet.contains(sectionID)) { sentenceCount = annotateParagraph(jcas, text, sa.getBegin(), sa.getEnd(), sentenceCount); } } } }
SentenceDetector extends JCasAnnotator_ImplBase { public void process(JCas jcas) throws AnalysisEngineProcessException { logger.info("Starting processing."); sentenceCount = 0; String text = jcas.getDocumentText(); JFSIndexRepository indexes = jcas.getJFSIndexRepository(); Iterator<?> sectionItr = indexes.getAnnotationIndex(Segment.type) .iterator(); while (sectionItr.hasNext()) { Segment sa = (Segment) sectionItr.next(); String sectionID = sa.getId(); if (!skipSegmentsSet.contains(sectionID)) { sentenceCount = annotateParagraph(jcas, text, sa.getBegin(), sa.getEnd(), sentenceCount); } } }  }
SentenceDetector extends JCasAnnotator_ImplBase { public void process(JCas jcas) throws AnalysisEngineProcessException { logger.info("Starting processing."); sentenceCount = 0; String text = jcas.getDocumentText(); JFSIndexRepository indexes = jcas.getJFSIndexRepository(); Iterator<?> sectionItr = indexes.getAnnotationIndex(Segment.type) .iterator(); while (sectionItr.hasNext()) { Segment sa = (Segment) sectionItr.next(); String sectionID = sa.getId(); if (!skipSegmentsSet.contains(sectionID)) { sentenceCount = annotateParagraph(jcas, text, sa.getBegin(), sa.getEnd(), sentenceCount); } } }  void initialize(UimaContext aContext); void process(JCas jcas); static void main(String[] args); static void usage(Logger log); static int parseInt(String s, Logger log); static File getReadableFile(String fn); static File getFileInExistingDir(String fn); }
SentenceDetector extends JCasAnnotator_ImplBase { public void process(JCas jcas) throws AnalysisEngineProcessException { logger.info("Starting processing."); sentenceCount = 0; String text = jcas.getDocumentText(); JFSIndexRepository indexes = jcas.getJFSIndexRepository(); Iterator<?> sectionItr = indexes.getAnnotationIndex(Segment.type) .iterator(); while (sectionItr.hasNext()) { Segment sa = (Segment) sectionItr.next(); String sectionID = sa.getId(); if (!skipSegmentsSet.contains(sectionID)) { sentenceCount = annotateParagraph(jcas, text, sa.getBegin(), sa.getEnd(), sentenceCount); } } }  void initialize(UimaContext aContext); void process(JCas jcas); static void main(String[] args); static void usage(Logger log); static int parseInt(String s, Logger log); static File getReadableFile(String fn); static File getFileInExistingDir(String fn); static final String PARAM_SEGMENTS_TO_SKIP; static final String SD_MODEL_FILE_PARAM; static final String PARAGRAPH_PATTERN; static final String ACRONYM_PATTERN; static final String PERIOD_PATTERN; static final String SPLIT_PATTERN; }