Is there a way to do ner.print-best with just selected labels?

I want to pipe the best possible examples in a dataset into ner.manual but I would like to limit to just a small subset of labels, potentially just: 0RG, MONEY.

Something like:

prodigy ner.print-best test-dataset en_core_web_lg --label "ORG, MONEY"

I can always filter out some afterwards but it would be cool if this is achievable in a single step.

You should be able to achieve that with a custom recipe pretty easily. You can use the current ner.print-best recipe as a starting point (the source is included in your Prodigy installation). The main loop would be just:


model = EntityRecognizer(spacy.load(spacy_model))
stream = model.make_best(DB.get_dataset(dataset))
for eg in stream:
    eg["spans"] = [span for span in eg["spans"] if span["label"] in target_labels]
    print(srsly.json_dumps(eg))