CleartkExtractor implements
    FeatureExtractor1<FOCUS_T>, FeatureExtractor2<FOCUS_T, FOCUS_T> { public List<Feature> extractBetween(JCas view, FOCUS_T annotation1, FOCUS_T annotation2) throws CleartkExtractorException { int begin = annotation1.getEnd(); int end = annotation2.getBegin(); Annotation focusAnnotation = new Annotation(view, begin, end); return this.extract(view, focusAnnotation, new NoBounds()); } CleartkExtractor(
      Class<SEARCH_T> annotationClass,
      FeatureExtractor1<SEARCH_T> extractor,
      Context... contexts); @Override List<Feature> extract(JCas view, FOCUS_T focusAnnotation); List<Feature> extractWithin(JCas view, FOCUS_T focusAnnotation, Annotation boundsAnnotation); List<Feature> extractBetween(JCas view, FOCUS_T annotation1, FOCUS_T annotation2); @Override java.util.List<Feature> extract(JCas view, FOCUS_T annotation1, FOCUS_T annotation2);  }
@Test public void testExtractBetween() throws Exception { CleartkExtractor<Chunk, Token> extractor = new CleartkExtractor<Chunk, Token>( Token.class, new CoveredTextExtractor<Token>(), new Bag(new Preceding(2)), new Covered(), new Ngram(new Following(3))); this.tokenBuilder.buildTokens( this.jCas, "She bought milk.\nHe sold oranges.", "She bought milk .\nHe sold oranges ."); Chunk boughMilk = new Chunk(this.jCas, 4, 15); boughMilk.addToIndexes(); Assert.assertEquals("bought milk", boughMilk.getCoveredText()); Chunk soldOranges = new Chunk(this.jCas, 20, 32); soldOranges.addToIndexes(); Assert.assertEquals("sold oranges", soldOranges.getCoveredText()); List<Feature> features = extractor.extractBetween(this.jCas, boughMilk, soldOranges); Assert.assertEquals(5, features.size()); Iterator<Feature> iter = features.iterator(); this.assertFeature("Bag_Preceding_0_2", "bought", iter.next()); this.assertFeature("Bag_Preceding_0_2", "milk", iter.next()); this.assertFeature("Covered_0", ".", iter.next()); this.assertFeature("Covered_1", "He", iter.next()); this.assertFeature("Ngram_Following_0_3", "sold_oranges_.", iter.next()); }