BaleenTextAwareAnnotator extends BaleenAnnotator { protected String getTextInTextBlocks(final JCas jCas) { final List<TextBlock> blocks = getTextBlocks(jCas); if (blocks.isEmpty()) { return ""; } else if (blocks.size() == 1 && blocks.get(0).isWholeDocument()) { return jCas.getDocumentText(); } else { return TEXT_BLOCK_JOINER.join(blocks.stream().map(TextBlock::getCoveredText).iterator()); } }   static final String TEXT_BLOCK_SEPARATOR; static final String PARAM_WHOLE_DOCUMENT; }
@Test public void testGetTextInBlocksForTextBlocks() { final FakeTextAwareAnnotator annotator = createAnnotator(false); final String s = annotator.getTextInTextBlocks(textJCas); assertEquals("text\n\nmore text", s); }
@Test public void testGetTextInBlocksForEntireDoc() { final FakeTextAwareAnnotator annotator = createAnnotator(false); final String s = annotator.getTextInTextBlocks(noTextJCas); assertEquals("This is text and more text", s); }
@Test public void testGetTextInBlocksWhenHasBlocksButWholeDocParamIsSet() { final FakeTextAwareAnnotator annotator = createAnnotator(true); final String s = annotator.getTextInTextBlocks(textJCas); assertEquals("This is text and more text", s); }