ner.teach throws an error for twitter dataset

I am trying to train a new entity type in Spacy using the trial VM provided.

The command " prodigy ner.teach drug_ner en_core_web_md "white house" --api twitter --label DRUG --patterns drugs_patterns1.jsonl" throws the below error,

Using 1 labels: DRUG
Traceback (most recent call last):
File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/home/prodigy/pgy-env/lib/python3.6/site-packages/prodigy/main.py", line 380, in
controller = recipe(args, use_plac=True)
File "cython_src/prodigy/core.pyx", line 212, in prodigy.core.recipe.recipe_decorator.recipe_proxy
File "/home/prodigy/pgy-env/lib/python3.6/site-packages/plac_core.py", line 328, in call
cmd, result = parser.consume(arglist)
File "/home/prodigy/pgy-env/lib/python3.6/site-packages/plac_core.py", line 207, in consume
return cmd, self.func(
(args + varargs + extraopts), **kwargs)
File "/home/prodigy/pgy-env/lib/python3.6/site-packages/prodigy/recipes/ner.py", line 117, in teach
source, api=api, loader=loader, rehash=True, dedup=True, input_key="text"
File "cython_src/prodigy/components/loaders.pyx", line 54, in prodigy.components.loaders.get_stream
File "cython_src/prodigy/components/loaders.pyx", line 539, in prodigy.components.loaders.Twitter.init
TypeError: argument after ** must be a mapping, not NoneType

Note: I have created a prodigy.json file in the root folder with the below data,
{"consumer_key": "XXXX", "consumer_secret": "XXXX", "access_token": "XXX-XX", "access_token_secret": "XXXX"}

Fixed this. I updated the prodigy.json file to change the json content to

{"api_keys": {"twitter": {"consumer_key": "XXXXXX", "consumer_secret": "XXXXX", "access_token": "XXX-XX", "access_token_secret": "XXXX"}}}

1 Like