# Error running textcat.batch-train if text is empty string

**URL:** <https://support.prodi.gy/t/error-running-textcat-batch-train-if-text-is-empty-string/68>\
**Category:** Uncategorized\
**Tags:** textcat, done\
**Created:** [October 25, 2017, 11:13pm UTC](https://support.prodi.gy/t/error-running-textcat-batch-train-if-text-is-empty-string/68 "2017-10-25T23:13:53Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![irfan-zoefit](https://avatars.discourse-cdn.com/v4/letter/i/9f8e36/32.png) [@irfan-zoefit](https://support.prodi.gy/u/irfan-zoefit)\
**Post date:** [November 16, 2017, 2:13pm UTC](https://support.prodi.gy/t/error-running-textcat-batch-train-if-text-is-empty-string/68/8 "2017-11-16T14:13:09Z")

</div>

I’m getting error `KeyError: 'text'`. Here is error log

```
prodigy ner.teach [dataset] 'en_core_web_sm' carecinch.jsonl 
Traceback (most recent call last):
  File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    " __main__", mod_spec)
  File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/prodigy/ __main__.py", line 238, in <module>
    controller = recipe(*args, use_plac=True)
  File "cython_src/prodigy/core.pyx", line 143, in prodigy.core.recipe.recipe_decorator.recipe_proxy
  File "cython_src/prodigy/util.pyx", line 173, in prodigy.util.suggest_view_id
  File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/toolz/itertoolz.py", line 368, in first
    return next(iter(seq))
  File "cython_src/prodigy/components/sorters.pyx", line 127, in __iter__
  File "cython_src/prodigy/components/sorters.pyx", line 53, in genexpr
  File "cython_src/prodigy/models/ner.pyx", line 215, in __call__
  File "cython_src/prodigy/models/ner.pyx", line 202, in get_tasks
  File "cython_src/prodigy/models/ner.pyx", line 178, in prodigy.models.ner.EntityRecognizer. __call__.get_tasks.sort_by_entity
KeyError: 'text'

```

There are some lines in data where spans are empty i.e.`{"text": "Patient is a white male", "spans": []}` and every line has a `text` and `spans`.

---

_[View the full topic](https://support.prodi.gy/t/error-running-textcat-batch-train-if-text-is-empty-string/68)._
