@Override public void collectionProcessComplete() throws AnalysisEngineProcessException { Segmentation segmentation; for (Word word : termIndexResource.getTermIndex().getWords()) { segmentation = manualCompositions.getSegmentation(word.getLemma()); if (segmentation != null) if (segmentation.size() <= 1) word.resetComposition(); } }
public List<TermWord> termWords(Object... objects) { List<TermWord> l = Lists.newArrayList(); for (int i = 0; i < objects.length; i += 2) { TermWord tw = Mockito.mock(TermWord.class); when(tw.getSyntacticLabel()).thenReturn((String) objects[i + 1]); Word w = Mockito.mock(Word.class); when(w.getLemma()).thenReturn((String) objects[i]); when(tw.getWord()).thenReturn(w); l.add(tw); } return l; }