kazu.annotation.label_studio¶
Classes
Converts a Kazu |
|
- class kazu.annotation.label_studio.KazuToLabelStudioConverter[source]¶
Bases:
object
Converts a Kazu
Document
into Label Studio tasks.Since LS is region based, we need to create a new region for every CharSpan (even overlapping ones), and add entity information (class, mappings etc) to the region.
- classmethod convert_multiple_docs_to_tasks(docs)[source]¶
If you want to utilise multiple annotation views in label studio, you can supply an iterable of sets of kazu documents annotated by different pipelines. The entity information from each will be added to an independent annotation set in label studio.
- class kazu.annotation.label_studio.LSToKazuConversion[source]¶
Bases:
object
- class kazu.annotation.label_studio.LabelStudioAnnotationView[source]¶
Bases:
object
- __init__(ner_labels)[source]¶
- Parameters:
ner_labels (dict[str, str]) – a mapping of ner label (i.e.
Entity.entity_class
) to a valid colour
- build_labels(dom, element)[source]¶
- Parameters:
dom (xml.dom.minidom.Document)
element (xml.dom.minidom.Element)
- Return type:
None
- static build_taxonomy(dom, element, tasks, name)[source]¶
- Parameters:
dom (xml.dom.minidom.Document)
element (xml.dom.minidom.Element)
name (str)
- Return type:
None
- class kazu.annotation.label_studio.LabelStudioManager[source]¶
Bases:
object
- update_tasks(docs: list[Document]) None [source]¶
- update_tasks(docs: list[set[Document]]) None
Add tasks to a label studio project.
- Parameters:
docs – either a list of kazu documents, or a list of a set of kazu documents. If using the latter, each document in the set should be identical, apart from the entity information. Each documents entity information will form a seperate annotation set in label studio.
- Returns:
- update_view(view: LabelStudioAnnotationView, docs: list[Document]) None [source]¶
- update_view(view: LabelStudioAnnotationView, docs: list[set[Document]]) None
Update the view of a label studio project.
- Parameters:
view
docs – either a list of kazu documents, or a list of a set of kazu documents. If using the latter, each document in the set should be identical, apart from the entity information. Each documents entity information will form a seperate annotation set in label studio.
- Returns: