SentenceAnnotator extends JCasAnnotator_ImplBase { @Override public void process(JCas jCas) throws AnalysisEngineProcessException { if (windowClasses == null) { String text = jCas.getDocumentText(); processText(jCas, text, 0); } else { for (Class<? extends Annotation> windowClass : windowClasses) { for (Annotation window : new ArrayList<Annotation>(JCasUtil.select(jCas, windowClass))) { String text = window.getCoveredText(); processText(jCas, text, window.getBegin()); } } } }  static AnalysisEngineDescription getDescription(); @Override void initialize(UimaContext uimaContext); @Override void process(JCas jCas); static final String PARAM_SENTENCE_MODEL_PATH; static final String PARAM_SENTENCE_TYPE_NAME; static final String PARAM_WINDOW_CLASS_NAMES; static final String multipleNewlinesRegex; }
@Test public void testManyNewlines() throws UIMAException { StringBuffer text = new StringBuffer(); for (int i = 0; i < 1000; i++) { text.append('\n'); } jCas.setDocumentText(text.toString()); sentenceSegmenter.process(jCas); sentenceSegmenter.collectionProcessComplete(); }