@Test public void testExtract() throws ResourceInitializationException, AnalysisEngineProcessException, TextClassificationException { AnalysisEngineDescription desc = createEngineDescription(BreakIteratorSegmenter.class); AnalysisEngine engine = createEngine(desc); JCas jcas1 = engine.newJCas(); jcas1.setDocumentLanguage("en"); jcas1.setDocumentText("This is the text of view 1. And some more."); engine.process(jcas1); JCas jcas2 = engine.newJCas(); jcas2.setDocumentLanguage("en"); jcas2.setDocumentText("This is the text of view 2."); engine.process(jcas2); DiffNrOfSentencesPairFeatureExtractor extractor = new DiffNrOfSentencesPairFeatureExtractor(); Set<Feature> features = extractor.extract(jcas1, jcas2); assertEquals(1, features.size()); for (Feature feature : features) { assertFeature("DiffNrOfSentences", 1, feature); } }
@Override public Set<Feature> extract(JCas view1, JCas view2) throws TextClassificationException { return new Feature("DiffNrOfSentences", JCasUtil.select(view1, Sentence.class).size() - JCasUtil.select(view2, Sentence.class).size(), FeatureType.NUMERIC).asSet(); }
DiffNrOfSentencesPairFeatureExtractor extends FeatureExtractorResource_ImplBase implements PairFeatureExtractor { @Override public Set<Feature> extract(JCas view1, JCas view2) throws TextClassificationException { return new Feature("DiffNrOfSentences", JCasUtil.select(view1, Sentence.class).size() - JCasUtil.select(view2, Sentence.class).size(), FeatureType.NUMERIC).asSet(); } }
DiffNrOfSentencesPairFeatureExtractor extends FeatureExtractorResource_ImplBase implements PairFeatureExtractor { @Override public Set<Feature> extract(JCas view1, JCas view2) throws TextClassificationException { return new Feature("DiffNrOfSentences", JCasUtil.select(view1, Sentence.class).size() - JCasUtil.select(view2, Sentence.class).size(), FeatureType.NUMERIC).asSet(); }  }
DiffNrOfSentencesPairFeatureExtractor extends FeatureExtractorResource_ImplBase implements PairFeatureExtractor { @Override public Set<Feature> extract(JCas view1, JCas view2) throws TextClassificationException { return new Feature("DiffNrOfSentences", JCasUtil.select(view1, Sentence.class).size() - JCasUtil.select(view2, Sentence.class).size(), FeatureType.NUMERIC).asSet(); }  @Override Set<Feature> extract(JCas view1, JCas view2); }
DiffNrOfSentencesPairFeatureExtractor extends FeatureExtractorResource_ImplBase implements PairFeatureExtractor { @Override public Set<Feature> extract(JCas view1, JCas view2) throws TextClassificationException { return new Feature("DiffNrOfSentences", JCasUtil.select(view1, Sentence.class).size() - JCasUtil.select(view2, Sentence.class).size(), FeatureType.NUMERIC).asSet(); }  @Override Set<Feature> extract(JCas view1, JCas view2);  }