snorkelflow.client.annotations.add_annotation
- snorkelflow.client.annotations.add_annotation(node, x_uid, label, metadata=None)
Add an annotation for a document or a span. The label for the annotation must be in the appropriate format expected by the model node specified by the “node” parameter. To learn more about label formats, see Format for ground truth interaction in the SDK.
Examples
>>> # Add a positive label for a document
>>> sf.add_annotation(node, "doc::1", "POS", metadata={"created by": "sdk"})
{
'annotation_uid': 12345,
'source': {
'source_uid': 1,
'source_type': 'user',
'source_name': 'my-name',
'user_uid': 0,
'metadata': {"created by": "sdk"}
},
'workspace_uid': 1
}Parameters
Parameters
Return type
Return type
List[Dict[str, any]
Name Type Default Info node intUID of the node. x_uid strUID of the document or span to be annotated. label AnyThe label for annotation (“POS”, “NEG”, etc). The format of the label depends on the configuration of the model node specified by the “node” parameter. metadata Optional[Dict]NoneAny metadata that we want to save for the annotation.