use of org.dkpro.tc.features.style.ContextualityMeasureFeatureExtractor in project dkpro-tc by dkpro.
the class ContextualityTest method posContextFeatureExtractorTest.
@Test
public void posContextFeatureExtractorTest() throws Exception {
AnalysisEngineDescription desc = createEngineDescription(createEngineDescription(BreakIteratorSegmenter.class), createEngineDescription(OpenNlpPosTagger.class, OpenNlpPosTagger.PARAM_LANGUAGE, "en"));
AnalysisEngine engine = createEngine(desc);
JCas jcas = engine.newJCas();
jcas.setDocumentLanguage("en");
jcas.setDocumentText("This is a test.");
engine.process(jcas);
TextClassificationTarget aTarget = new TextClassificationTarget(jcas, 0, jcas.getDocumentText().length());
aTarget.addToIndexes();
ContextualityMeasureFeatureExtractor extractor = new ContextualityMeasureFeatureExtractor();
List<Feature> features = new ArrayList<Feature>(extractor.extract(jcas, aTarget));
Assert.assertEquals(8, features.size());
for (Feature feature : features) {
if (feature.getName().equals(CONTEXTUALITY_MEASURE_FN)) {
assertFeature(CONTEXTUALITY_MEASURE_FN, 50.2, feature);
}
}
}
Aggregations