Search in sources :

Example 1 with Organization

use of de.tudarmstadt.ukp.dkpro.core.api.ner.type.Organization 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);
}
Also used : Organization(de.tudarmstadt.ukp.dkpro.core.api.ner.type.Organization) TextClassificationTarget(org.dkpro.tc.api.type.TextClassificationTarget) JCas(org.apache.uima.jcas.JCas) Person(de.tudarmstadt.ukp.dkpro.core.api.ner.type.Person) Sentence(de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Sentence) Feature(org.dkpro.tc.api.features.Feature) AnalysisEngine(org.apache.uima.analysis_engine.AnalysisEngine) Location(de.tudarmstadt.ukp.dkpro.core.api.ner.type.Location) Test(org.junit.Test)

Aggregations

Location (de.tudarmstadt.ukp.dkpro.core.api.ner.type.Location)1 Organization (de.tudarmstadt.ukp.dkpro.core.api.ner.type.Organization)1 Person (de.tudarmstadt.ukp.dkpro.core.api.ner.type.Person)1 Sentence (de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Sentence)1 AnalysisEngine (org.apache.uima.analysis_engine.AnalysisEngine)1 JCas (org.apache.uima.jcas.JCas)1 Feature (org.dkpro.tc.api.features.Feature)1 TextClassificationTarget (org.dkpro.tc.api.type.TextClassificationTarget)1 Test (org.junit.Test)1