Search in sources :

Example 1 with SharedNEsFeatureExtractor

use of org.dkpro.tc.features.pair.core.ne.SharedNEsFeatureExtractor in project dkpro-tc by dkpro.

the class SharedNEsFeatureExtractorTest method extractTest1.

@Test
public void extractTest1() throws Exception {
    NamedEntity ne1 = new NamedEntity(jcas1, 0, 4);
    ne1.addToIndexes();
    SharedNEsFeatureExtractor extractor = new SharedNEsFeatureExtractor();
    Set<Feature> features = extractor.extract(jcas1, jcas2);
    assertEquals(1, features.size());
    for (Feature feature : features) {
        assertFeature("SharedNEs", false, feature);
    }
    NamedEntity ne2 = new NamedEntity(jcas2, 0, 4);
    ne2.addToIndexes();
    features = extractor.extract(jcas1, jcas2);
    assertEquals(1, features.size());
    for (Feature feature : features) {
        assertFeature("SharedNEs", true, feature);
    }
}
Also used : NamedEntity(de.tudarmstadt.ukp.dkpro.core.api.ner.type.NamedEntity) FeatureTestUtil.assertFeature(org.dkpro.tc.testing.FeatureTestUtil.assertFeature) Feature(org.dkpro.tc.api.features.Feature) SharedNEsFeatureExtractor(org.dkpro.tc.features.pair.core.ne.SharedNEsFeatureExtractor) Test(org.junit.Test)

Aggregations

NamedEntity (de.tudarmstadt.ukp.dkpro.core.api.ner.type.NamedEntity)1 Feature (org.dkpro.tc.api.features.Feature)1 SharedNEsFeatureExtractor (org.dkpro.tc.features.pair.core.ne.SharedNEsFeatureExtractor)1 FeatureTestUtil.assertFeature (org.dkpro.tc.testing.FeatureTestUtil.assertFeature)1 Test (org.junit.Test)1