Search in sources :

Example 6 with Chunk

use of de.tudarmstadt.ukp.dkpro.core.api.syntax.type.chunk.Chunk in project dkpro-tc by dkpro.

the class DiffNounChunkTokenLengthTest method extractTest1.

@Test
public void extractTest1() throws Exception {
    Chunk chunk1 = new Chunk(jcas1, 0, 4);
    chunk1.addToIndexes();
    Chunk chunk2 = new Chunk(jcas2, 0, 4);
    chunk2.addToIndexes();
    DiffNounChunkTokenLength extractor = new DiffNounChunkTokenLength();
    Set<Feature> features = extractor.extract(jcas1, jcas2);
    assertEquals(1, features.size());
    for (Feature feature : features) {
        assertFeature("DiffNounPhraseTokenLength", 0.0, feature, 0.0001);
    }
}
Also used : DiffNounChunkTokenLength(org.dkpro.tc.features.pair.core.chunk.DiffNounChunkTokenLength) Chunk(de.tudarmstadt.ukp.dkpro.core.api.syntax.type.chunk.Chunk) FeatureTestUtil.assertFeature(org.dkpro.tc.testing.FeatureTestUtil.assertFeature) Feature(org.dkpro.tc.api.features.Feature) Test(org.junit.Test)

Example 7 with Chunk

use of de.tudarmstadt.ukp.dkpro.core.api.syntax.type.chunk.Chunk in project dkpro-tc by dkpro.

the class DiffNounChunkTokenLengthTest method extractTest2.

@Test
public void extractTest2() throws Exception {
    Chunk chunk1 = new Chunk(jcas1, 0, 4);
    chunk1.addToIndexes();
    Chunk chunk2 = new Chunk(jcas2, 0, 7);
    chunk2.addToIndexes();
    DiffNounChunkTokenLength extractor = new DiffNounChunkTokenLength();
    Set<Feature> features = extractor.extract(jcas1, jcas2);
    assertEquals(1, features.size());
    for (Feature feature : features) {
        assertFeature("DiffNounPhraseTokenLength", -1.0, feature, 0.0001);
    }
}
Also used : DiffNounChunkTokenLength(org.dkpro.tc.features.pair.core.chunk.DiffNounChunkTokenLength) Chunk(de.tudarmstadt.ukp.dkpro.core.api.syntax.type.chunk.Chunk) FeatureTestUtil.assertFeature(org.dkpro.tc.testing.FeatureTestUtil.assertFeature) Feature(org.dkpro.tc.api.features.Feature) Test(org.junit.Test)

Aggregations

Chunk (de.tudarmstadt.ukp.dkpro.core.api.syntax.type.chunk.Chunk)7 Feature (org.dkpro.tc.api.features.Feature)4 FeatureTestUtil.assertFeature (org.dkpro.tc.testing.FeatureTestUtil.assertFeature)4 Test (org.junit.Test)4 AnnotationFeature (de.tudarmstadt.ukp.clarin.webanno.model.AnnotationFeature)2 AnnotationLayer (de.tudarmstadt.ukp.clarin.webanno.model.AnnotationLayer)2 DiffNounChunkCharacterLength (org.dkpro.tc.features.pair.core.chunk.DiffNounChunkCharacterLength)2 DiffNounChunkTokenLength (org.dkpro.tc.features.pair.core.chunk.DiffNounChunkTokenLength)2 HashSet (java.util.HashSet)1