Unable to rely on a feature of a custom layer for annotation
Describe the bug Issue with feature annotation that is linked to a custom layer
To Reproduce Here is a snippet of my typesstsem file.
<typeDescription>
<name>webanno.custom.Concept</name>
<description/>
<supertypeName>uima.tcas.Annotation</supertypeName>
<features>
<featureDescription>
<name>Date</name>
<description/>
<rangeTypeName>uima.cas.String</rangeTypeName>
</featureDescription>
<featureDescription>
<name>Disease</name>
<description/>
<rangeTypeName>uima.cas.String</rangeTypeName>
</featureDescription>
<featureDescription>
<name>Value</name>
<description/>
<rangeTypeName>uima.cas.String</rangeTypeName>
</featureDescription>
<featureDescription>
<name>Insect</name>
<description/>
<rangeTypeName>uima.cas.String</rangeTypeName>
</featureDescription>
<featureDescription>
<name>Location</name>
<description/>
<rangeTypeName>uima.cas.String</rangeTypeName>
</featureDescription>
<featureDescription>
<name>Pest</name>
<description/>
<rangeTypeName>uima.cas.String</rangeTypeName>
</featureDescription>
<featureDescription>
<name>Plant</name>
<description/>
<rangeTypeName>uima.cas.String</rangeTypeName>
</featureDescription>
</features>
</typeDescription>
Here is the piece of code to create the annotation:
SENTENCE_TYPE = "de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Sentence"
TOKEN_TYPE = "de.tudarmstadt.ukp.dkpro.core.api.segmentation.type.Token"
NER_TYPE = "webanno.custom.Concept"
Sentence = ts.get_type(SENTENCE_TYPE)
Token = ts.get_type(TOKEN_TYPE)
NamedEntity = ts.get_type(NER_TYPE)
for named_entity in entities:
cas_named_entity = NamedEntity(begin=named_entity[0], end=named_entity[1], label = named_entity[2])
cas.add_annotation(cas_named_entity)
assert named_entity[2] == cas_named_entity.get_covered_text()
named_entity contains as example (43, 50, Date)
If possible, attach a minimal file that triggers the error.
Error message `TypeError: webanno_custom_Concept.init() got an unexpected keyword argument 'label'
The same error occurs when I replace label= named_entity[2] by value= named_entity[2] or by the name of the feature Date date= named_entity[2].
Please complete the following information:
- Version:0.7.3
- OS: Linux [e.g. Windows, Linux, OS X]
Additional context
I specify that everything works correctly when I use the primitive layer Span instead of the custom layer created.
Your type system does not seem to have a feature called label. There is a Value and Date but you seem to have tried value and date in your Python code. Feature names are case sensitive.
Thanks @reckart for your reply. I fixed it and it seems to work except that in inception it's rather the terms that are displayed instead of the name of the feature as in the following image.

The expected behavior: The displayed tag of Brazil's must be Location since it is linked to the feature Location.
Do I need to add a Label feature to solve this or I missed doing something. Thanks
Hi,
from the code you provided, it seems like you assign the term by yourself, named_entity[2] has to be the term text because otherwise your assert would fail.
cas_named_entity = NamedEntity(begin=named_entity[0], end=named_entity[1], label = named_entity[2])
cas.add_annotation(cas_named_entity)
assert named_entity[2] == cas_named_entity.get_covered_text()