snorkelflow.client.annotations.update_annotation
- snorkelflow.client.annotations.update_annotation(node, annotation_uid, label, metadata=None)
Updates the value of an already-created annotation. This will maintain the original author and timestamp of the annotation. Use
sf.delete_annotation
and sf.add_annotation` for hard overwrites, where you want to overwrite all annotation data.Examples
>>> sf.get_annotations(0).loc["doc::0"].loc[123]
{'annotation_uid': 123, 'x_uid': 'doc::0', 'label': 'POS'}
>>> sf.update_annotation(0, 123, "NEG", metadata={"updated by": "sdk"})
>>> sf.get_annotations(0).loc["doc::0"].loc[123]
{'annotation_uid': 123, 'x_uid': 'doc::0', 'label': 'NEG', metadata={"updated by": "sdk"}}Parameters
Parameters
Raises
Raises
ValueError – If the label supplied is not valid for the given node
ValueError – If we are unable to successfully fetch the node information
ValueError – If updating the annotation fails
Return type
Return type
None
Name Type Default Info node int
The UID of the node the annotation is in. annotation_uid int
The UID for the annotation to update. label str
The new label for the annotation. metadata Optional[Dict]
None
Optional metadata to update, by default None.