Skip to content
Snippets Groups Projects

Helper for ListCorpusEntities

Merged Thibault Lavigne requested to merge helper-for-list-corpus-entities into master
All threads resolved!
3 files
+ 91
11
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -193,3 +193,28 @@ class EntityMixin(object):
return self.api_client.paginate(
"ListTranscriptionEntities", id=transcription.id, **query_params
)
def list_corpus_entities(
self,
name: str = None,
parent: Element = None,
):
"""
List all entities in the worker's corpus
This method does not support cache
:param name str: Filter entities by part of their name (case-insensitive)
:param parent Element: Restrict entities to those linked to all transcriptions of an element and all its descendants. Note that links to metadata are ignored.
"""
query_params = {}
if name is not None:
assert name and isinstance(name, str), "name should be of type str"
query_params["name"] = name
if parent is not None:
assert isinstance(parent, Element), "parent should be of type Element"
query_params["parent"] = parent.id
return self.api_client.paginate(
"ListCorpusEntities", id=self.corpus_id, **query_params
)
Loading