Adding new label

Hey @pkras

What might help is to connect to the database programmatically using Python, and work on the label/s you're interested in. With that you can run your experiments separately. For example:

from prodigy.components.db import connect
db = connect()
examples = db.get_dataset("your_dataset_with_all_labels")

new_examples = []
labels_to_keep = ["A", "B", "C"]  # you can whitelist or blacklist

for eg in examples:
    # you can whitelist or blacklist
    spans = [span for span in eg.get("spans", []) if span["label"] in labels_to_keep]
    eg["spans"] = spans
    new_examples.append(eg)

db.add_dataset("your_new_dataset")
db.add_examples(new_examples, ["your_new_dataset"])

You can check this related thread for more info :smiley:

1 Like