snorkelflow.studio.spacy_labeling_function
- 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:
name (
Optional
[str
], default:None
) – Name of the LFresources (
Optional
[Mapping
[str
,Any
]], default:None
) – Labeling resources passed in tof
viakwargs
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__(name=None, resources=None)
Methods
__init__
([name, resources])