# Spancat Give scores 0

**URL:** <https://support.prodi.gy/t/spancat-give-scores-0/6520>\
**Category:** Uncategorized\
**Created:** [April 28, 2023, 4:07pm UTC](https://support.prodi.gy/t/spancat-give-scores-0/6520 "2023-04-28T16:07:40Z")\
**Posts on this page:** 1\
**Showing post:** 5

<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:** [May 4, 2023, 5:38pm UTC](https://support.prodi.gy/t/spancat-give-scores-0/6520/5 "2023-05-04T17:38:44Z")

</div>

hi @padejumo,

I'm glad you found the issue.

> [@padejumo](#):
>
> The spans I'm labeling are on the larger side, so I need n-grams between 5-20. Are there any other suggestions to resolve this issue? It doesn't seem like NER runs into this same problem, at what point would you suggest switching over to NER instead of spancat?

That's really hard because it likely depends on the context and your own preferences. One important point is that if you annotated with a `spans` recipe, make sure you didn't make an overlapping spans as its permissible with `spans` recipes but not `ner`. If you try to train `ner`, you'll get an error if there are overlapping spans.

Not sure if you've seen it, but there's also a spaCy template project that compares `spancat` vs. `ner`:

> <https://github.com/explosion/projects/tree/v3/experimental/ner_spancat_compare>
>
> //github.com/explosion/projects/tree/v3/experimental/ner\_spancat\_compare

> [@padejumo](#):
>
> Proposed solutions involve reducing the n-grams, nlp batch size or training.batcher size.

You could also try modifying your suggester function. Also, are you using `data-to-spacy` so as to run `spacy train` instead of `prodigy train`? I doubt that'll do much for memory, but it does give you the ability to span characteristics via `spacy debug data` (see the `ner_spancat_compare` project for more details).

> [@training long sequence on spancat memory problem](https://support.prodi.gy/t/training-long-sequence-on-spancat-memory-problem/6462/2):
>
> Hi @kushal_pythonist, Have you seen this post? You should consider modifying your suggested function. Have you tried to identify any outlier text inputs? For example, try to train on half of your data. If it still doesn't train, then try on first 10%, etc. You may be able to find a few records that drive this. If you run data-to-spacy --spancat your\_dataset then run [data debug](https://spacy.io/api/cli#debug-data), you can get some stats on your span characteristics. If your pipeline contains a spancat component, then this c…

It may be a not an option, but any way you could even reframe your problem by splitting it up someway and using `textcat` instead? This post mentions it and a few related ideas.

> **[What is the maximum length the annotation of a span can be? · explosion/spaCy...](https://github.com/explosion/spaCy/discussions/11450#discussioncomment-3592377)**
>
> Hi, I am trying to train a span categorizer but since I'm new to it, I am a bit unsure how to annotate my data. I'm using the spancat as a parser to extract specific sections from a document. Somet...

Hope this helps!

---

_[View the full topic](https://support.prodi.gy/t/spancat-give-scores-0/6520)._
