Preprocessor { TextAnnotation annotate(String corpusId, String sentId, String[] tokens) throws AnnotatorException { List<String[]> words = Collections.singletonList(Arrays.copyOfRange(tokens, 1, tokens.length)); TextAnnotation ta = BasicTextAnnotationBuilder.createTextAnnotationFromTokens(corpusId, sentId, words); ta.addView(pos); ta.addView(lemma); ta.addView(chunk); return ta; } Preprocessor(); void annotate(TextAnnotation ta);  }
@Test public void annotate() throws Exception { Preprocessor preprocessor = new Preprocessor(); String[] sentTokens = {"<root>", "This", "is", "a", "test", "sentence"}; TextAnnotation ta = preprocessor.annotate("testCorpus", "testSent1", sentTokens); assertNotNull(ta); assertTrue(ta.hasView(ViewNames.POS)); assertTrue(ta.hasView(ViewNames.LEMMA)); assertTrue(ta.hasView(ViewNames.SHALLOW_PARSE)); assertEquals("NN", ta.getView(ViewNames.POS).getLabelsCoveringToken(4).get(0)); }