Can't run the spacy spancat (spancategorizer) model? #11517
-
I am trying to train the spancat model without luck.
I did convert my NER ents to spans:
Here is my config file:
I am using the "sc" key. Please advise how to solve it. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 2 replies
-
Hi @steve-solun , please don't tag individual maintainers in the forums. As for your question, can you try using a from spacy.tokens import SpanGroup
group = SpanGroup(doc, name="sc", spans=spans)
doc.spans["sc"] = group Where the |
Beta Was this translation helpful? Give feedback.
-
@ljvmiranda921 thanks a lot for your answer dear. I am sorry but what are
|
Beta Was this translation helpful? Give feedback.
-
I have solved it using the following function, but one should address the spans Span(doc, start, end, label) according to the project/text for their task. It worked for me because all the text (a few words in my case) are labeled with a label and this is my need.
|
Beta Was this translation helpful? Give feedback.
Hi @steve-solun , please don't tag individual maintainers in the forums. As for your question, can you try using a
SpanGroup
instead of alist
when assigning todoc.spans[spans_key]
? Something like this:Where the
spans
are your entities in theDoc
. After converting them, you might want to sanity-check ifdoc.spans
do indeed contain the spans you assigned (plus their annotations).