@Test public void greedyStringTilingFeatureExtractorTest() throws Exception { AnalysisEngine engine = createEngine(NoOpAnnotator.class); JCas jcas = engine.newJCas(); jcas.setDocumentLanguage("en"); jcas.setDocumentText("1234567890"); engine.process(jcas); JCas jcas2 = engine.newJCas(); jcas2.setDocumentLanguage("en"); jcas2.setDocumentText("12345"); engine.process(jcas2); GreedyStringTilingFeatureExtractor extractor = new GreedyStringTilingFeatureExtractor(); Set<Feature> features1 = extractor.extract(jcas, jcas2); assertEquals(1, features1.size()); Feature f1 = features1.iterator().next(); assertEquals(f1.getValue(), 0.5); }
@Override public Set<Feature> extract(JCas view1, JCas view2) throws TextClassificationException { try { double similarity = measure.getSimilarity(view1.getDocumentText(), view2.getDocumentText()); return new Feature("Similarity" + measure.getName(), similarity, FeatureType.NUMERIC) .asSet(); } catch (SimilarityException e) { throw new TextClassificationException(e); } }
GreedyStringTilingFeatureExtractor extends FeatureExtractorResource_ImplBase implements PairFeatureExtractor { @Override public Set<Feature> extract(JCas view1, JCas view2) throws TextClassificationException { try { double similarity = measure.getSimilarity(view1.getDocumentText(), view2.getDocumentText()); return new Feature("Similarity" + measure.getName(), similarity, FeatureType.NUMERIC) .asSet(); } catch (SimilarityException e) { throw new TextClassificationException(e); } } }
GreedyStringTilingFeatureExtractor extends FeatureExtractorResource_ImplBase implements PairFeatureExtractor { @Override public Set<Feature> extract(JCas view1, JCas view2) throws TextClassificationException { try { double similarity = measure.getSimilarity(view1.getDocumentText(), view2.getDocumentText()); return new Feature("Similarity" + measure.getName(), similarity, FeatureType.NUMERIC) .asSet(); } catch (SimilarityException e) { throw new TextClassificationException(e); } }  }
GreedyStringTilingFeatureExtractor extends FeatureExtractorResource_ImplBase implements PairFeatureExtractor { @Override public Set<Feature> extract(JCas view1, JCas view2) throws TextClassificationException { try { double similarity = measure.getSimilarity(view1.getDocumentText(), view2.getDocumentText()); return new Feature("Similarity" + measure.getName(), similarity, FeatureType.NUMERIC) .asSet(); } catch (SimilarityException e) { throw new TextClassificationException(e); } }  @Override Set<Feature> extract(JCas view1, JCas view2); }
GreedyStringTilingFeatureExtractor extends FeatureExtractorResource_ImplBase implements PairFeatureExtractor { @Override public Set<Feature> extract(JCas view1, JCas view2) throws TextClassificationException { try { double similarity = measure.getSimilarity(view1.getDocumentText(), view2.getDocumentText()); return new Feature("Similarity" + measure.getName(), similarity, FeatureType.NUMERIC) .asSet(); } catch (SimilarityException e) { throw new TextClassificationException(e); } }  @Override Set<Feature> extract(JCas view1, JCas view2);  }