Created
March 6, 2019 23:34
-
-
Save lfoppiano/f052de094f5920136f511cf67a1e0d08 to your computer and use it in GitHub Desktop.
prodigy recipe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import prodigy | |
from prodigy.components.loaders import JSONL | |
from prodigy.util import split_string | |
@prodigy.recipe('superconductor-material-recipe', | |
dataset=prodigy.recipe_args['dataset'], | |
source=("The source data as a JSONL file", "positional", None, str), | |
label=("One or more comma-separated labels", "option", "l", split_string)) | |
def superconductors_detection(dataset, source=None, label=None): | |
if source: | |
stream = JSONL(source) | |
# else: | |
# stream = add_options(stream) | |
def progress(session, total): | |
return total / 10000 | |
return { | |
'dataset': dataset, | |
'view_id': 'ner_manual', | |
'stream': stream, | |
'config': { | |
'label': ', '.join(label) if label is not None else 'all', | |
'labels': label # Selectable label options | |
}, | |
'progress': progress | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment