use of org.apache.uima.resource.metadata.TypeSystemDescription in project webanno by webanno.
the class TypeSystemAnalysisTest method testSpanWithPrimitiveFeatures.
@Test
public void testSpanWithPrimitiveFeatures() throws Exception {
TypeSystemDescription tsd = createTypeSystemDescription("tsd/spanWithPrimitiveFeatures");
TypeSystemAnalysis analysis = TypeSystemAnalysis.of(tsd);
AnnotationLayer spanLayer = new AnnotationLayer();
spanLayer.setName("webanno.custom.Span");
spanLayer.setUiName("Span");
spanLayer.setType(WebAnnoConst.SPAN_TYPE);
spanLayer.setLockToTokenOffset(false);
spanLayer.setAllowStacking(true);
spanLayer.setCrossSentence(true);
AnnotationFeature stringFeature = new AnnotationFeature("stringFeature", CAS.TYPE_NAME_STRING);
AnnotationFeature intFeature = new AnnotationFeature("intFeature", CAS.TYPE_NAME_INTEGER);
AnnotationFeature booleanFeature = new AnnotationFeature("booleanFeature", CAS.TYPE_NAME_BOOLEAN);
AnnotationFeature floatFeature = new AnnotationFeature("floatFeature", CAS.TYPE_NAME_FLOAT);
SoftAssertions softly = new SoftAssertions();
softly.assertThat(analysis.getLayers()).containsExactly(spanLayer).usingFieldByFieldElementComparator();
softly.assertThat(analysis.getFeatures(spanLayer.getName())).containsExactlyInAnyOrder(stringFeature, intFeature, booleanFeature, floatFeature).usingFieldByFieldElementComparator();
softly.assertAll();
}
use of org.apache.uima.resource.metadata.TypeSystemDescription in project webanno by webanno.
the class TypeSystemAnalysisTest method testSpanWithSlotFeatures.
@Test
public void testSpanWithSlotFeatures() throws Exception {
TypeSystemDescription tsd = createTypeSystemDescription("tsd/spanWithSlotFeatures");
TypeSystemAnalysis analysis = TypeSystemAnalysis.of(tsd);
AnnotationLayer slotSpanLayer = new AnnotationLayer();
slotSpanLayer.setName("webanno.custom.SlotSpan");
slotSpanLayer.setUiName("SlotSpan");
slotSpanLayer.setType(WebAnnoConst.SPAN_TYPE);
slotSpanLayer.setLockToTokenOffset(false);
slotSpanLayer.setAllowStacking(true);
slotSpanLayer.setCrossSentence(true);
AnnotationFeature freeSlot = new AnnotationFeature("freeSlot", CAS.TYPE_NAME_ANNOTATION);
AnnotationFeature boundSlot = new AnnotationFeature("boundSlot", "webanno.custom.SlotSpan");
SoftAssertions softly = new SoftAssertions();
softly.assertThat(analysis.getLayers()).containsExactly(slotSpanLayer).usingFieldByFieldElementComparator();
softly.assertThat(analysis.getFeatures(slotSpanLayer.getName())).containsExactlyInAnyOrder(freeSlot, boundSlot).usingFieldByFieldElementComparator();
softly.assertAll();
}
use of org.apache.uima.resource.metadata.TypeSystemDescription in project webanno by webanno.
the class TypeSystemAnalysisTest method testChain.
@Test
public void testChain() throws Exception {
TypeSystemDescription tsd = createTypeSystemDescription("tsd/chain");
TypeSystemAnalysis analysis = TypeSystemAnalysis.of(tsd);
AnnotationLayer chainLayer = new AnnotationLayer();
chainLayer.setName("webanno.custom.Chain");
chainLayer.setUiName("Chain");
chainLayer.setType(WebAnnoConst.CHAIN_TYPE);
chainLayer.setLockToTokenOffset(false);
chainLayer.setAllowStacking(true);
chainLayer.setCrossSentence(true);
AnnotationFeature referenceRelationFeature = new AnnotationFeature("referenceRelation", CAS.TYPE_NAME_STRING);
AnnotationFeature referenceTypeFeature = new AnnotationFeature("referenceType", CAS.TYPE_NAME_STRING);
SoftAssertions softly = new SoftAssertions();
softly.assertThat(analysis.getLayers()).containsExactlyInAnyOrder(chainLayer).usingFieldByFieldElementComparator();
softly.assertThat(analysis.getFeatures(chainLayer.getName())).containsExactlyInAnyOrder(referenceRelationFeature, referenceTypeFeature).usingFieldByFieldElementComparator();
softly.assertAll();
}
use of org.apache.uima.resource.metadata.TypeSystemDescription in project webanno by webanno.
the class TypeSystemAnalysisTest method testRelationWithPrimitiveFeatures.
@Test
public void testRelationWithPrimitiveFeatures() throws Exception {
TypeSystemDescription tsd = createTypeSystemDescription("tsd/relationWithPrimitiveFeatures");
TypeSystemAnalysis analysis = TypeSystemAnalysis.of(tsd);
AnnotationLayer relationLayer = new AnnotationLayer();
relationLayer.setName("webanno.custom.Relation");
relationLayer.setUiName("Relation");
relationLayer.setType(WebAnnoConst.RELATION_TYPE);
relationLayer.setLockToTokenOffset(false);
relationLayer.setAllowStacking(true);
relationLayer.setCrossSentence(true);
AnnotationLayer relationTargetLayer = new AnnotationLayer();
relationTargetLayer.setName("webanno.custom.RelationTarget");
relationTargetLayer.setUiName("RelationTarget");
relationTargetLayer.setType(WebAnnoConst.SPAN_TYPE);
relationTargetLayer.setLockToTokenOffset(false);
relationTargetLayer.setAllowStacking(true);
relationTargetLayer.setCrossSentence(true);
AnnotationFeature stringFeature = new AnnotationFeature("stringFeature", CAS.TYPE_NAME_STRING);
AnnotationFeature intFeature = new AnnotationFeature("intFeature", CAS.TYPE_NAME_INTEGER);
AnnotationFeature booleanFeature = new AnnotationFeature("booleanFeature", CAS.TYPE_NAME_BOOLEAN);
AnnotationFeature floatFeature = new AnnotationFeature("floatFeature", CAS.TYPE_NAME_FLOAT);
SoftAssertions softly = new SoftAssertions();
softly.assertThat(analysis.getLayers()).containsExactlyInAnyOrder(relationLayer, relationTargetLayer).usingFieldByFieldElementComparator();
softly.assertThat(analysis.getFeatures(relationLayer.getName())).containsExactlyInAnyOrder(stringFeature, intFeature, booleanFeature, floatFeature).usingFieldByFieldElementComparator();
softly.assertAll();
}
use of org.apache.uima.resource.metadata.TypeSystemDescription in project webanno by webanno.
the class TypeSystemAnalysisTest method testTheFullMonty.
@Test
public void testTheFullMonty() throws Exception {
TypeSystemDescription tsd = createTypeSystemDescription("tsd/fullMonty");
TypeSystemAnalysis analysis = TypeSystemAnalysis.of(tsd);
SoftAssertions softly = new SoftAssertions();
softly.assertThat(analysis.getLayers()).extracting(l -> l.getName() + ":" + l.getType()).hasSize(27).containsExactlyInAnyOrder("de.tudarmstadt.ukp.dkpro.core.api.coref.type.Coreference:chain", "de.tudarmstadt.ukp.dkpro.core.api.lexmorph.type.morph.Morpheme:span", "de.tudarmstadt.ukp.dkpro.core.api.lexmorph.type.morph.MorphologicalFeatures:span", "de.tudarmstadt.ukp.dkpro.core.api.lexmorph.type.pos.POS:span", "de.tudarmstadt.ukp.dkpro.core.api.metadata.type.MetaDataStringField:span", "de.tudarmstadt.ukp.dkpro.core.api.ner.type.NamedEntity:span", "de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Div:span", "de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Lemma:span", "de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.LexicalPhrase:span", "de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.NGram:span", "de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Stem:span", "de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.StopWord:span", "de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.SurfaceForm:span", "de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.TokenForm:span", "de.tudarmstadt.ukp.dkpro.core.api.semantics.type.SemArg:span", "de.tudarmstadt.ukp.dkpro.core.api.semantics.type.SemPred:span", "de.tudarmstadt.ukp.dkpro.core.api.semantics.type.SemanticArgument:span", "de.tudarmstadt.ukp.dkpro.core.api.semantics.type.SemanticField:span", "de.tudarmstadt.ukp.dkpro.core.api.semantics.type.WordSense:span", "de.tudarmstadt.ukp.dkpro.core.api.syntax.type.PennTree:span", "de.tudarmstadt.ukp.dkpro.core.api.syntax.type.Tag:span", "de.tudarmstadt.ukp.dkpro.core.api.syntax.type.chunk.Chunk:span", "de.tudarmstadt.ukp.dkpro.core.api.syntax.type.dependency.Dependency:relation", "de.tudarmstadt.ukp.dkpro.core.api.transform.type.SofaChangeAnnotation:span", "webanno.custom.Chain:chain", "webanno.custom.Relation:relation", "webanno.custom.SlotSpan:span");
softly.assertAll();
}
Aggregations