Skip to main content
Version: 25.4

snorkelflow.studio.spacy_labeling_function

warning

This is a beta function in 25.4. Beta features may have known gaps or bugs, but are functional workflows and eligible for Snorkel Support. To access beta features, contact Snorkel Support to enable the feature flag for your Snorkel-hosted instance.

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

Bases: resources_fn_labeling_function

Convenience decorator for spacy based labeling functions.

The decorated function must have an additional nlp argument which represents the spacy en-core-web-sm 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 spacy_labeling_function
>>> @spacy_labeling_function(name="my_spacy_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])