Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reading annotations in Document Metadata #24

Open
Rachneet opened this issue Dec 9, 2022 · 3 comments
Open

Reading annotations in Document Metadata #24

Rachneet opened this issue Dec 9, 2022 · 3 comments

Comments

@Rachneet
Copy link

Rachneet commented Dec 9, 2022

Outline

We have some annotations in the document metadata that we want to access. But the project view does not include them and gives an empty result.

Description:

We have a layer for answer preference where the user chooses between 2 answers and gives a reason. The layer is of type Document metadata since the annotation is document-level.

All our other layers are span-level and the library can read those out.

For this specific case,

preference_layer = "webanno.custom.Answerpreferencev1"
print(f'Features: {project.features(preference_layer)}')
feature = 'Reason'
feature_path = f'{preference_layer}>{feature}'


# select reduced view
reduced_pref_annos = project.select(
    annotation=feature_path,
    annotators=['jim', 'jam'],
    source_files=["x.txt", "y.txt"]
)

print('# pref. annotations in view:', reduced_pref_annos.count())
print('# annotations per file per annotator', reduced_pref_annos.count(grouped_by=['source_file', 'annotator']))

And the result is:

# pref. annotations in view: 0
# annotations per file per annotator Series([], Name: annotation, dtype: int64)
@zesch
Copy link
Collaborator

zesch commented Dec 9, 2022

Does it work if you use the layer, not the feature path?

@Rachneet
Copy link
Author

Nope, it doesn't.

@zesch
Copy link
Collaborator

zesch commented Dec 14, 2022

you are right, the way how we currently parse the inception project into our internal format only works for span annotations. We are working on a fix. Thanks for bringing this up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants