/** * Returns the text tokenized and pos-tagged, in that order. * * @param text * @return * @throws AnalysisEngineProcessException */ private List<String[]> tokenize(String text) throws AnalysisEngineProcessException { jCas.reset(); jCas.setDocumentText(text); new Sentence(jCas, 0, text.length()).addToIndexes(); jtbd.process(jCas.getCas()); pennbioIEPosTagger.process(jCas.getCas()); return JCasUtil.select(jCas, Token.class).stream() .map(t -> new String[] { t.getCoveredText(), t.getPosTag(0).getValue() }).collect(Collectors.toList()); }