Skip to content
Discussion options

You must be logged in to vote

Hey,
Thanks for the report, however, this isn't a spaCy issue.

The problem is the _ents list, every iteration, you're adding more entities to the list from different doc objects and trying to set them as .ents per individual doc. That's why you're getting the ValueError.

Here's a suggestion on how to fix your problem, you initialize the _ents list inside the loop, so that it doesn't collect all the entities from different doc objects.

for ents in ents_data:
                doc = nlp(ents["text"])
                _ents = [] # Add the list inside the loop
                for ent in ents["ents"]:
                    start = ent["start"]
                    end = ent["end"]
                  …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by thomashacker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat / doc Feature: Doc, Span and Token objects
2 participants
Converted from issue

This discussion was converted from issue #12370 on March 06, 2023 14:41.