KeyError: 'text' when starting prodigy to add named entity


I’am new to Prodigy. The following error is given by Prodigy when I want to add a new entity type to the dutch model:

17:28:57 - Exception when serving /get_questions
Traceback (most recent call last):
  File "/home/bart/anaconda3/envs/lab/lib/python3.6/site-packages/waitress/", line 338, in service
  File "/home/bart/anaconda3/envs/lab/lib/python3.6/site-packages/waitress/", line 169, in service
  File "/home/bart/anaconda3/envs/lab/lib/python3.6/site-packages/waitress/", line 399, in execute
    app_iter =, start_response)
  File "/home/bart/anaconda3/envs/lab/lib/python3.6/site-packages/hug/", line 424, in api_auto_instantiate
    return module.__hug_wsgi__(*args, **kwargs)
  File "/home/bart/anaconda3/envs/lab/lib/python3.6/site-packages/falcon/", line 244, in __call__
    responder(req, resp, **params)
  File "/home/bart/anaconda3/envs/lab/lib/python3.6/site-packages/hug/", line 734, in __call__
    raise exception
  File "/home/bart/anaconda3/envs/lab/lib/python3.6/site-packages/hug/", line 709, in __call__
    self.render_content(self.call_function(input_parameters), request, response, **kwargs)
  File "/home/bart/anaconda3/envs/lab/lib/python3.6/site-packages/hug/", line 649, in call_function
    return self.interface(**parameters)
  File "/home/bart/anaconda3/envs/lab/lib/python3.6/site-packages/hug/", line 100, in __call__
    return __hug_internal_self._function(*args, **kwargs)
  File "/home/bart/anaconda3/envs/lab/lib/python3.6/site-packages/prodigy/", line 82, in get_questions
    tasks = controller.get_questions()
  File "cython_src/prodigy/core.pyx", line 87, in prodigy.core.Controller.get_questions
  File "cython_src/prodigy/core.pyx", line 71, in iter_tasks
  File "cython_src/prodigy/components/sorters.pyx", line 136, in __iter__
  File "cython_src/prodigy/components/sorters.pyx", line 51, in genexpr
  File "cython_src/prodigy/util.pyx", line 270, in predict
  File "/home/bart/anaconda3/envs/lab/lib/python3.6/site-packages/toolz/", line 716, in partition_all
    prev = next(it)
  File "cython_src/prodigy/components/preprocess.pyx", line 36, in split_sentences
  File "/home/bart/anaconda3/envs/lab/lib/python3.6/site-packages/spacy/", line 554, in pipe
    for doc, context in izip(docs, contexts):
  File "/home/bart/anaconda3/envs/lab/lib/python3.6/site-packages/spacy/", line 578, in pipe
    for doc in docs:
  File "nn_parser.pyx", line 367, in pipe
  File "cytoolz/itertoolz.pyx", line 1046, in cytoolz.itertoolz.partition_all.__next__ (cytoolz/itertoolz.c:14538)
  File "/home/bart/anaconda3/envs/lab/lib/python3.6/site-packages/spacy/", line 752, in _pipe
    for doc in docs:
  File "/home/bart/anaconda3/envs/lab/lib/python3.6/site-packages/spacy/", line 557, in <genexpr>
    docs = (self.make_doc(text) for text in texts)
  File "/home/bart/anaconda3/envs/lab/lib/python3.6/site-packages/spacy/", line 550, in <genexpr>
    texts = (tc[0] for tc in text_context1)
  File "cython_src/prodigy/components/preprocess.pyx", line 35, in genexpr
KeyError: 'text'

The command I used on Ubuntu is:

prodigy ner.teach sentence nl_core_news_sm sentences.csv --patterns patterns_soft.jsonl --label SOFTWARE

I attached small set with training data. Please advice.

sentences.jsonl (20.1 KB)

It looks like the answer might be very simple (hopefully not too frustratingly simple :wink:). In your data, the key is "TEXT" – but Prodigy expects it to be "text" and Python is case-sensitive.

So changing that column header in your CSV file or the key in your JSONL file should fix it!

Hi Ines,

Yes oeps… It’s now working fine. Thanks!!!:thinking:

1 Like