use of de.tudarmstadt.ukp.dkpro.core.api.ner.type.NamedEntity in project webanno by webanno.
the class WebAnnoTsv3WriterTestBase method testTokenBoundedSpanWithoutFeatureValue.
@Test
public void testTokenBoundedSpanWithoutFeatureValue() throws Exception {
JCas jcas = makeJCasOneSentence();
for (Token t : select(jcas, Token.class)) {
NamedEntity ne = new NamedEntity(jcas, t.getBegin(), t.getEnd());
ne.addToIndexes();
}
writeAndAssertEquals(jcas, WebannoTsv3Writer.PARAM_SPAN_LAYERS, asList(NamedEntity.class));
}
use of de.tudarmstadt.ukp.dkpro.core.api.ner.type.NamedEntity in project webanno by webanno.
the class WebAnnoTsv3WriterTestBase method testSubMultiTokenSpanWithoutFeatureValue3.
@Test
public void testSubMultiTokenSpanWithoutFeatureValue3() throws Exception {
JCas jcas = makeJCasOneSentence();
NamedEntity ne1 = new NamedEntity(jcas, 1, 6);
ne1.addToIndexes();
NamedEntity ne2 = new NamedEntity(jcas, 6, 12);
ne2.addToIndexes();
writeAndAssertEquals(jcas, WebannoTsv3Writer.PARAM_SPAN_LAYERS, asList(NamedEntity.class));
}
use of de.tudarmstadt.ukp.dkpro.core.api.ner.type.NamedEntity in project webanno by webanno.
the class WebAnnoTsv3WriterTestBase method testMultiTokenStackedSpanWithFeatureValue.
@Test
public void testMultiTokenStackedSpanWithFeatureValue() throws Exception {
JCas jcas = makeJCasOneSentence();
NamedEntity ne1 = new NamedEntity(jcas, 0, jcas.getDocumentText().length());
ne1.setValue("PERSON");
ne1.addToIndexes();
NamedEntity ne2 = new NamedEntity(jcas, 0, jcas.getDocumentText().length());
ne2.setValue("LOCATION");
ne2.addToIndexes();
writeAndAssertEquals(jcas, WebannoTsv3Writer.PARAM_SPAN_LAYERS, asList(NamedEntity.class));
}
use of de.tudarmstadt.ukp.dkpro.core.api.ner.type.NamedEntity in project webanno by webanno.
the class WebAnnoTsv3WriterTestBase method testSingleNonMultiTokenRelationWithMultipleFeatureValues.
@Test
public void testSingleNonMultiTokenRelationWithMultipleFeatureValues() throws Exception {
JCas jcas = makeJCasOneSentence();
CAS cas = jcas.getCas();
List<Token> tokens = new ArrayList<>(select(jcas, Token.class));
Token t1 = tokens.get(0);
Token t2 = tokens.get(1);
Token t3 = tokens.get(2);
Token t4 = tokens.get(3);
NamedEntity gov = new NamedEntity(jcas, t1.getBegin(), t2.getEnd());
gov.addToIndexes();
NamedEntity dep = new NamedEntity(jcas, t3.getBegin(), t4.getEnd());
dep.addToIndexes();
Type relationType = cas.getTypeSystem().getType("webanno.custom.ComplexRelation");
// One at the beginning
// WebAnno legacy conventions
// AnnotationFS fs1 = cas.createAnnotation(relationType,
// min(dep.getBegin(), gov.getBegin()),
// max(dep.getEnd(), gov.getEnd()));
// DKPro Core conventions
AnnotationFS fs1 = cas.createAnnotation(relationType, dep.getBegin(), dep.getEnd());
FSUtil.setFeature(fs1, "Governor", gov);
FSUtil.setFeature(fs1, "Dependent", dep);
FSUtil.setFeature(fs1, "value", "nsubj");
FSUtil.setFeature(fs1, "boolValue", true);
FSUtil.setFeature(fs1, "intValue", 42);
cas.addFsToIndexes(fs1);
writeAndAssertEquals(jcas, WebannoTsv3Writer.PARAM_SPAN_LAYERS, asList(NamedEntity.class), WebannoTsv3Writer.PARAM_RELATION_LAYERS, asList("webanno.custom.ComplexRelation"));
}
use of de.tudarmstadt.ukp.dkpro.core.api.ner.type.NamedEntity in project webanno by webanno.
the class WebAnnoTsv3WriterTestBase method testMultiTokenStackedSpanWithoutFeatureValue.
@Test
public void testMultiTokenStackedSpanWithoutFeatureValue() throws Exception {
JCas jcas = makeJCasOneSentence();
NamedEntity ne1 = new NamedEntity(jcas, 0, jcas.getDocumentText().length());
ne1.addToIndexes();
NamedEntity ne2 = new NamedEntity(jcas, 0, jcas.getDocumentText().length());
ne2.addToIndexes();
writeAndAssertEquals(jcas, WebannoTsv3Writer.PARAM_SPAN_LAYERS, asList(NamedEntity.class));
}
Aggregations