Skip to main content
Version: 0.95

snorkelflow.studio.stanza_labeling_function

class snorkelflow.studio.stanza_labeling_function(name=None, resources=None)

Bases: resources_fn_labeling_function

Convenience decorator for stanza based labeling functions.

The decorated function must have an additional nlp argument which represents the stanza en model.

Parameters:
  • name (Optional[str], default: None) – Name of the LF

  • resources (Optional[Mapping[str, Any]], default: None) – Labeling resources passed in to f via kwargs

Examples

>>> from snorkelflow.studio import stanza_labeling_function
>>> @stanza_labeling_function(name="my_stanza_lf")
... def many_entities(x, nlp) -> int:
... return 0 if len(nlp(x.txt).ents) > 5 else -1
__init__(name=None, resources=None)

Methods

__init__([name, resources])