# Textcat using span overlapping view

**URL:** <https://support.prodi.gy/t/textcat-using-span-overlapping-view/6434>\
**Category:** Uncategorized\
**Tags:** front-end, textcat, spancat\
**Created:** [March 15, 2023, 4:48pm UTC](https://support.prodi.gy/t/textcat-using-span-overlapping-view/6434 "2023-03-15T16:48:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![darrylestrada97](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/darrylestrada97/32/2456_2.png) [@darrylestrada97](https://support.prodi.gy/u/darrylestrada97)\
**Post date:** [March 15, 2023, 4:48pm UTC](https://support.prodi.gy/t/textcat-using-span-overlapping-view/6434/1 "2023-03-15T16:48:25Z")

</div>

Hi!, I am trying to use the overlapping feature of spancat inside the textcat, by adding the span key inside my dataset, but all I get is the regular ner view, it doesnt allow overlapping. For example my data looks like this.

{"text":"Biomaterials and medical devices are broadly used in the diagnosis, treatment, repair, replacement or enhancing functions of human tissues or organs. Although the living conditions of human beings have been steadily improved in most parts of the world. ","label":"ID: 27047681","spans":[{ "start": 0, "end": 12, "label": "ORG" },{ "start": 0, "end": 12, "label": "ORG\_2" }]}

and I am getting a view like this one.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/prodigy/original/2X/3/31a42298487deec3499dd809ae859a72d04664ab.png)

is there anyway I can change this behavior and use the spancat viewer instead, so that I can have overlapping mentions.

Thanks.

---

<div class="post-metadata">

**Author:** ![ryanwesslen](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/ryanwesslen/32/2969_2.png) [@ryanwesslen](https://support.prodi.gy/u/ryanwesslen)\
**Post date:** [March 15, 2023, 6:14pm UTC](https://support.prodi.gy/t/textcat-using-span-overlapping-view/6434/2 "2023-03-15T18:14:11Z")

</div>

hi @darrylestrada97!

Thanks for your question!

Are you looking for this?

 ![image](https://us1.discourse-cdn.com/flex020/uploads/prodigy/original/2X/b/b5f75425fc0e1e674525d561c6543022778215de.png)

I wrote a custom recipe that does this:

> <https://gist.github.com/wesslen/31c44ca0f83242c512772dcfe15a81fc>

```bash
python -m prodigy textcat.manual.spans issue-6434 blank:en overlapping.jsonl -F textcat-manual-spans.py

```

It's a bit of a hack, but essentially you need to pass the `stream` through `get_tokens()`, which will add tokens to the stream (see line 42 of gist), which will switch it to `spans_manual`. If you remove this line, then it'll opt for the `ner_manual` interface, i.e., non-overlapping spans.

I didn't get a chance to dig deeply in the UI's. But my hypothesis on why this works is that the `spans_manual` interface may need tokens; hence, you need to tokenize the stream. In order to do this, you need to add in a spaCy tokenizer (i.e., notice that `textcat.manual` does not require a `model` as it doesn't do tokenization by default).

I'll raise this point to the Prodigy front-end leads to see if this is intended behavior and see if we need to make any changes.

Does this work-around solve your problem for now? I'll post back if we make changes on this in the future.

---

<div class="post-metadata">

**Author:** ![darrylestrada97](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/darrylestrada97/32/2456_2.png) [@darrylestrada97](https://support.prodi.gy/u/darrylestrada97)\
**Post date:** [March 16, 2023, 3:25pm UTC](https://support.prodi.gy/t/textcat-using-span-overlapping-view/6434/3 "2023-03-16T15:25:09Z")

</div>

It looks like what I wanted but the flag --label is not working, how could I had the labels?

---

<div class="post-metadata">

**Author:** ![magdaaniol](https://sea2.discourse-cdn.com/flex020/user_avatar/support.prodi.gy/magdaaniol/32/2787_2.png) [@magdaaniol](https://support.prodi.gy/u/magdaaniol)\
**Post date:** [March 16, 2023, 5:16pm UTC](https://support.prodi.gy/t/textcat-using-span-overlapping-view/6434/4 "2023-03-16T17:16:13Z")

</div>

Hey @darrylestrada97,

Great job on modifying Ryan's snippet to add the labels! It looks to me like your version does the job. Let me know if you're still miss anything.
