Skip to content

Filter documents with respect to the presence of a specific annotation #4

@BastienRance

Description

@BastienRance

Code to filter document with respect to the presence of a specific annotation:

def filter_by_annotation(annotated_docs, pymedext_docs, filters):
    docs = []
    index = 0
    for d in annotated_docs:
        document_added = False
        for a in d['annotations']:
            if a['type'] in filters:
                if(not document_added):
                    docs.append(pymedext_docs[index])
                    document_added = True
        index += 1
    return docs

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions