Skip to main content
Version: 25.3

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

NameTypeDefaultInfo
nameOptional[str]NoneName of the LF.
resourcesOptional[Mapping[str, Any]]NoneLabeling 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__

__init__(name=None, resources=None)

Methods

__init__([name, resources])