Here Dependencies and Relations · Prodigy · An annotation tool for AI, Machine Learning & NLP
I've tried to save as custom_dep.py
import prodigy
from prodigy.components.loaders import JSONL
from prodigy.components.preprocess import add_tokens
import spacy
@prodigy.recipe("custom-dep")
def custom_dep_recipe(dataset, source):
stream = JSONL(source) # load the data
stream = add_relations_to_stream(stream) # add custom relations
stream = add_tokens(spacy.blank("en"), stream) # add "tokens" to stream
return {
"dataset": dataset, # dataset to save annotations to
"stream": stream, # the incoming stream of examples
"view_id": "relations", # annotation interface to use
"labels": ["ROOT", "nsubj", "amod", "dobj"] # labels to annotate
}
and smoke test run like this
prodigy custom-dep tmp ./foo.jsonl -F custom_dep.py
but prodigy does not accept that
$ prodigy custom-dep tmp ./foo.jsonl -F custom_dep.py
✘ Invalid components returned by recipe 'custom-dep'
labels extra fields not permitted
{'dataset': 'tmp', 'stream': <generator object at 0x129d009a0>, 'view_id': 'relations', 'labels': ['ROOT', 'nsubj', 'amod', 'dobj']}