Skip to content

Instantly share code, notes, and snippets.

@lfoppiano
Created March 6, 2019 23:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lfoppiano/f052de094f5920136f511cf67a1e0d08 to your computer and use it in GitHub Desktop.
Save lfoppiano/f052de094f5920136f511cf67a1e0d08 to your computer and use it in GitHub Desktop.
prodigy recipe
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