cannot add new recipe

I’m trying to add a new receipe to do text tagging and I’ve written (copy-pasted from the example about sentiments) something like:

    import prodigy
from prodigy.components.loaders import JSONL

                file_path=("Path to texts", "positional", None, str))
def sentiment(dataset, file_path):
    """Annotate the sentiment of texts using different mood options."""
    stream = JSONL(file_path)  # load in the JSONL file
    # stream = add_options(stream)  # add options to each task

    return {
        'dataset': dataset,  # save annotations in this dataset
        'view_id': 'ner_manual',  # use the choice interface
        'stream': stream,

Then when trying to import it I got this criptic message:

(pyscript) Lucas-MacBook-Pro:prodigy-preprocessing lfoppiano$ prodigy superconductor-material-recipe supercon1 -h

  ✨  ERROR: Can't find recipe or command

Any idea?

Thank you in advance

1 Like

I think the problem here is that you need to use the -F option on the command line to point to the recipe file. For example, like this:

prodigy superconductor-material-recipe supercon1 -F

If a recipe path is provided via the -F argument, Prodigy will try to load the recipe from that file. If not, it’ll look in the built-in recipes and raise an error if it can’t find a recipe of the given name – which seems to have happened in your case.

1 Like

Hi Ines and thanks for your answer
I did tried that already and the answer was:

(pyscript) Lucas-MacBook-Pro:prodigy-preprocessing lfoppiano$ prodigy superconductor-material-recipe supercon1 -F
usage: prodigy superconductor-material-recipe [-h] dataset file_path
prodigy superconductor-material-recipe: error: the following arguments are required: file_path
(pyscript) Lucas-MacBook-Pro:prodigy-preprocessing lfoppiano$ 

The receipt is in the directory:

(pyscript) Lucas-MacBook-Pro:prodigy-preprocessing lfoppiano$ ls -lh 
-rw-r--r--  1 lfoppiano  staff   634B Mar  4 18:09

the prodigy version looks correct:

(pyscript) Lucas-MacBook-Pro:prodigy-preprocessing lfoppiano$ pip list | grep prodigy
prodigy           1.7.1     
(pyscript) Lucas-MacBook-Pro:prodigy-preprocessing lfoppiano$ 

moreover the helper menu doesn’t really have any info about new recipes:

(pyscript) Lucas-MacBook-Pro:prodigy-preprocessing lfoppiano$ prodigy --help

  ✨  Available recipes:
  ner.match, ner.teach, ner.manual, ner.make-gold, ner.eval, ner.eval-ab,
  ner.batch-train, ner.train-curve, ner.print-best, ner.print-stream,
  ner.print-dataset,, ner.iob-to-gold

  textcat.teach, textcat.batch-train, textcat.train-curve, textcat.eval,
  textcat.print-stream, textcat.print-dataset

  dep.teach, dep.batch-train, dep.train-curve, compare, pos.teach,
  pos.make-gold, pos.batch-train, pos.train-curve,,
  terms.train-vectors, terms.teach,, mark, image.manual,

  ✨  Available commands:
  dataset, drop, stats, pipe, db-in, db-out

Is there a way to get more information from the output response of the application?


I have found a solution, which I’m not sure is the right one…

superconductor-material-recipe supercon1 output.json.text-0.json -F

so we have to specify also the text we want to apply our recipe, is that correct?

This bring me to another topic I’ve opened a specific thread for: prodigy use case for annotation having pre-annotated text

I have a question though, how should the recipe be modified if I want the single annotations to be shown and corrected? How could I add them in the recipe?

The recipe can define any arguments that you can then pass through via the command line. This completely up to you. In your custom recipe, you’ve defined two arguments: the dataset and the file_path. See here:

                file_path=("Path to texts", "positional", None, str))
def sentiment(dataset, file_path):

So on the command line, the recipe then expects you to pass in those two arguments.