I want to perform an on_exit function while using the built in ner.match recipe. I have gone through the provided documents and i cannot seem to figure out how to add the on_exit function to the ner.match recipe
My code rn looks something like this
import prodigy
from prodigy.recipes.ner import match
@prodigy.recipe('custom.ner.match',
dataset=prodigy.recipe_args['dataset'],
spacy_model=prodigy.recipe_args['spacy_model'],
source=prodigy.recipe_args['source'],
patterns=prodigy.recipe_args['patterns'])
def custom_ner_match(dataset, spacy_model, source, patterns):
"""Custom wrapper for ner.teach recipe that replaces the stream."""
components = match(dataset=dataset, spacy_model=spacy_model,
source=source, patterns=patterns)
return components
def on_exit(controller):
"""DO SOMETHING"""
return(0)
Thanks!