@Test public void testAll() throws ResourceInitializationException, AnalysisEngineProcessException { final AnalysisEngine analysisEngine = AnalysisEngineFactory.createEngine( CompoundPartTokenizer.class, CompoundPartTokenizer.PARAM_COMPOUND_SPLIT_LEVEL, CompoundSplitLevel.ALL); final JCas jcas = getJCas(analysisEngine); analysisEngine.process(jcas); final String[] splitsList = new String[] { GETRANKAUTOMAT, GETRANK, "automat", "auto", "mat" }; final String[] tokensList = new String[5]; final String[] posList = new String[] { "NN", "NN", "NN", "NN", "NN" }; final String[] obtainedPosList = new String[5]; int index = 0; for (Token token : JCasUtil.select(jcas, Token.class)) { tokensList[index] = token.getCoveredText(); obtainedPosList[index] = token.getPos().getPosValue(); ++index; } assertThat(tokensList, is(splitsList)); assertThat(obtainedPosList, is(posList)); }
@Override public void process(final JCas aJCas) throws AnalysisEngineProcessException { Token token; for (Compound compound : JCasUtil.select(aJCas, Compound.class)) { final Token compoundToken = JCasUtil.selectCovered(aJCas, Token.class, compound.getBegin(), compound.getEnd()).get(0); for (Split compoundPart : compound.getSplitsWithoutMorpheme(compoundSplitLevel)) { token = new Token(aJCas); token.setBegin(compoundPart.getBegin()); token.setEnd(compoundPart.getEnd()); token.setPos(compoundToken.getPos()); token.addToIndexes(); } } }
CompoundPartTokenizer extends JCasAnnotator_ImplBase { @Override public void process(final JCas aJCas) throws AnalysisEngineProcessException { Token token; for (Compound compound : JCasUtil.select(aJCas, Compound.class)) { final Token compoundToken = JCasUtil.selectCovered(aJCas, Token.class, compound.getBegin(), compound.getEnd()).get(0); for (Split compoundPart : compound.getSplitsWithoutMorpheme(compoundSplitLevel)) { token = new Token(aJCas); token.setBegin(compoundPart.getBegin()); token.setEnd(compoundPart.getEnd()); token.setPos(compoundToken.getPos()); token.addToIndexes(); } } } }
CompoundPartTokenizer extends JCasAnnotator_ImplBase { @Override public void process(final JCas aJCas) throws AnalysisEngineProcessException { Token token; for (Compound compound : JCasUtil.select(aJCas, Compound.class)) { final Token compoundToken = JCasUtil.selectCovered(aJCas, Token.class, compound.getBegin(), compound.getEnd()).get(0); for (Split compoundPart : compound.getSplitsWithoutMorpheme(compoundSplitLevel)) { token = new Token(aJCas); token.setBegin(compoundPart.getBegin()); token.setEnd(compoundPart.getEnd()); token.setPos(compoundToken.getPos()); token.addToIndexes(); } } }  }
CompoundPartTokenizer extends JCasAnnotator_ImplBase { @Override public void process(final JCas aJCas) throws AnalysisEngineProcessException { Token token; for (Compound compound : JCasUtil.select(aJCas, Compound.class)) { final Token compoundToken = JCasUtil.selectCovered(aJCas, Token.class, compound.getBegin(), compound.getEnd()).get(0); for (Split compoundPart : compound.getSplitsWithoutMorpheme(compoundSplitLevel)) { token = new Token(aJCas); token.setBegin(compoundPart.getBegin()); token.setEnd(compoundPart.getEnd()); token.setPos(compoundToken.getPos()); token.addToIndexes(); } } }  @Override void process(final JCas aJCas); }
CompoundPartTokenizer extends JCasAnnotator_ImplBase { @Override public void process(final JCas aJCas) throws AnalysisEngineProcessException { Token token; for (Compound compound : JCasUtil.select(aJCas, Compound.class)) { final Token compoundToken = JCasUtil.selectCovered(aJCas, Token.class, compound.getBegin(), compound.getEnd()).get(0); for (Split compoundPart : compound.getSplitsWithoutMorpheme(compoundSplitLevel)) { token = new Token(aJCas); token.setBegin(compoundPart.getBegin()); token.setEnd(compoundPart.getEnd()); token.setPos(compoundToken.getPos()); token.addToIndexes(); } } }  @Override void process(final JCas aJCas); static final String PARAM_COMPOUND_SPLIT_LEVEL; }