use of org.apache.uima.resource.metadata.TypeSystemDescription in project webanno by webanno.
the class TypeSystemAnalysisTest method testCreta.
@Test
public void testCreta() throws Exception {
TypeSystemDescription tsd = createTypeSystemDescription("3rd-party-tsd/creta-typesystem");
TypeSystemAnalysis analysis = TypeSystemAnalysis.of(tsd);
SoftAssertions softly = new SoftAssertions();
softly.assertThat(analysis.getLayers()).extracting(l -> l.getName() + ":" + l.getType()).hasSize(58).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.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.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.uni_potsdam.acl.type.Chunk:span", "de.uni_potsdam.acl.type.ClusteredEventMention:span", "de.uni_potsdam.acl.type.Mention:span", "de.uni_potsdam.acl.type.Negation:span", "de.uni_potsdam.acl.type.Sentiment:span", "de.unihd.dbs.uima.types.heideltime.Dct:span", "de.unihd.dbs.uima.types.heideltime.Sentence:span", "de.unihd.dbs.uima.types.heideltime.SourceDocInfo:span", "de.unihd.dbs.uima.types.heideltime.Timex3:span", "de.unihd.dbs.uima.types.heideltime.Timex3Interval:span", "de.unihd.dbs.uima.types.heideltime.Token:span", "de.unistuttgart.ims.creta.api.Entity:span", "de.unistuttgart.ims.creta.api.ExampleType:span", "de.unistuttgart.ims.creta.api.Format:span", "de.unistuttgart.ims.creta.api.Line:span", "de.unistuttgart.ims.creta.api.Quotation:span", "de.unistuttgart.ims.creta.api.Stage:span", "de.unistuttgart.ims.creta.api.Utterance:span", "de.unistuttgart.ims.type.Agenda:span", "de.unistuttgart.ims.type.Chunk:span", "de.unistuttgart.ims.type.HumanAnnotation:span", "de.unistuttgart.ims.type.Keyword:span", "de.unistuttgart.ims.type.Link:span", "de.unistuttgart.ims.type.Markable:span", "de.unistuttgart.ims.type.NE:span", "de.unistuttgart.ims.type.Paragraph:span", "de.unistuttgart.ims.type.Quotation:span", "de.unistuttgart.ims.type.Section:span", "de.unistuttgart.ims.type.Sentence:span", "de.unistuttgart.ims.type.Speaker:span", "de.unistuttgart.ims.type.Token:span", "de.unistuttgart.ims.uimautil.WordListDescription:span", "org.cleartk.ne.type.Ace2005Document:span", "org.cleartk.ne.type.Chunk:span", "org.cleartk.score.type.ScoredAnnotation:span", "org.cleartk.srl.type.Chunk:span", "org.cleartk.timeml.type.Anchor:span", "org.cleartk.timeml.type.Event:span", "org.cleartk.token.type.Subtoken:span", "org.cleartk.token.type.Token:span");
softly.assertAll();
}
use of org.apache.uima.resource.metadata.TypeSystemDescription in project webanno by webanno.
the class TypeSystemAnalysisTest method testCcpTypeSystem.
@Test
public void testCcpTypeSystem() throws Exception {
TypeSystemDescription tsd = createTypeSystemDescription("3rd-party-tsd/CcpTypeSystem");
TypeSystemAnalysis analysis = TypeSystemAnalysis.of(tsd);
SoftAssertions softly = new SoftAssertions();
softly.assertThat(analysis.getLayers()).hasSize(0);
softly.assertAll();
}
use of org.apache.uima.resource.metadata.TypeSystemDescription in project webanno by webanno.
the class AllAnnotationsIndexedCheckTest method testOK.
@Test
public void testOK() throws Exception {
TypeSystemDescription tsd = UIMAFramework.getResourceSpecifierFactory().createTypeSystemDescription();
String refTypeName = "RefType";
TypeDescription refTypeDesc = tsd.addType(refTypeName, null, CAS.TYPE_NAME_ANNOTATION);
refTypeDesc.addFeature("ref", null, CAS.TYPE_NAME_ANNOTATION);
CAS cas = CasCreationUtils.createCas(tsd, null, null);
Type refType = cas.getTypeSystem().getType(refTypeName);
// A regular index annotation
AnnotationFS anno1 = cas.createAnnotation(cas.getAnnotationType(), 0, 1);
cas.addFsToIndexes(anno1);
// An indexed annotation but reachable through an indexe one (below)
AnnotationFS anno2 = cas.createAnnotation(cas.getAnnotationType(), 0, 1);
cas.addFsToIndexes(anno2);
// An indexed annotation that references the non-indexed annotation above
AnnotationFS anno3 = cas.createAnnotation(refType, 0, 1);
anno3.setFeatureValue(refType.getFeatureByBaseName("ref"), anno2);
cas.addFsToIndexes(anno3);
List<LogMessage> messages = new ArrayList<>();
CasDoctor cd = new CasDoctor(AllFeatureStructuresIndexedCheck.class);
// A project is not required for this check
boolean result = cd.analyze(null, cas, messages);
messages.forEach(System.out::println);
assertTrue(result);
}
use of org.apache.uima.resource.metadata.TypeSystemDescription in project webanno by webanno.
the class AllAnnotationsIndexedCheckTest method testFail.
@Test
public void testFail() throws Exception {
TypeSystemDescription tsd = UIMAFramework.getResourceSpecifierFactory().createTypeSystemDescription();
String refTypeName = "RefType";
TypeDescription refTypeDesc = tsd.addType(refTypeName, null, CAS.TYPE_NAME_ANNOTATION);
refTypeDesc.addFeature("ref", null, CAS.TYPE_NAME_ANNOTATION);
CAS cas = CasCreationUtils.createCas(tsd, null, null);
Type refType = cas.getTypeSystem().getType(refTypeName);
// A regular index annotation
AnnotationFS anno1 = cas.createAnnotation(cas.getAnnotationType(), 0, 1);
cas.addFsToIndexes(anno1);
// A non-index annotation but reachable through an indexe one (below)
AnnotationFS anno2 = cas.createAnnotation(cas.getAnnotationType(), 0, 1);
// An indexed annotation that references the non-indexed annotation above
AnnotationFS anno3 = cas.createAnnotation(refType, 0, 1);
anno3.setFeatureValue(refType.getFeatureByBaseName("ref"), anno2);
cas.addFsToIndexes(anno3);
List<LogMessage> messages = new ArrayList<>();
CasDoctor cd = new CasDoctor(AllFeatureStructuresIndexedCheck.class);
// A project is not required for this check
boolean result = cd.analyze(null, cas, messages);
messages.forEach(System.out::println);
assertFalse(result);
}
Aggregations