I'm using prodigy for text classification,, we faced issue while annotation, so it stops before completing the task, the actual message says "No Tasks Available". We're using custom recipe.. Here's the code
import prodigy
from prodigy.components.preprocess import add_tokens
from prodigy.components.loaders import JSONL
import spacy
@prodigy.recipe(
"classification-context",
dataset=("The dataset to save to", "positional", None, str),
file_path=("Path to texts", "positional", None, str),
)
def cat_facts_ner(dataset, file_path, lang="en"):
blocks = [
{"view_id": "choice", "text": None},
{"view_id": "text_input", "field_rows": 5, "field_label": "Feedback"}
]
# nlp = spacy.blank(lang) # blank spaCy pipeline for tokenization
stream = JSONL(file_path) # load in the JSONL file
stream = add_options(stream) # add label options to each task
# stream = add_tokens(nlp, stream) # tokenize the stream for ner_manual
return {
"dataset": dataset, # the dataset to save annotations to
"view_id": "blocks", # set the view_id to "blocks"
"stream": list(stream), # the stream of incoming examples
"config": {
"blocks": blocks # add the blocks to the config
}
}
def add_options(stream):
# Helper function to add options to every task in a stream
options = [
{"id": 3, "text": "Positive"},
{"id": 2, "text": "Negative"},
{"id": 1, "text": "Neutral"},
{"id": 0, "text": "Ambivalent"}
]
for task in stream:
task["options"] = options
yield task