use of de.tudarmstadt.ukp.dkpro.core.api.ner.type.Location in project dkpro-tc by dkpro.
the class NETest method nEFeatureExtractorTest.
@Test
public void nEFeatureExtractorTest() throws Exception {
AnalysisEngine engine = createEngine(NoOpAnnotator.class);
JCas jcas = engine.newJCas();
engine.process(jcas);
TextClassificationTarget aTarget = new TextClassificationTarget(jcas, 0, 22);
aTarget.addToIndexes();
Location l1 = new Location(jcas, 0, 5);
Person p1 = new Person(jcas, 0, 5);
Organization o1 = new Organization(jcas, 0, 5);
Sentence s1 = new Sentence(jcas, 0, 15);
Sentence s2 = new Sentence(jcas, 15, 22);
l1.addToIndexes();
p1.addToIndexes();
o1.addToIndexes();
s1.addToIndexes();
s2.addToIndexes();
NamedEntityPerSentenceRatio extractor = new NamedEntityPerSentenceRatio();
Set<Feature> features1 = extractor.extract(jcas, aTarget);
assertEquals(6, features1.size());
testFeatures(features1, 1, 1, 1, 0.5f, 0.5f, 0.5f);
}
Aggregations