Skip to content
Discussion options

You must be logged in to vote

Like the error states, you can't merge a span of zero length into a new token - it's unclear what that should do, besides nothing. Here's a shorter example that gives the same error:

import spacy

nlp = spacy.blank("en")

doc = nlp("fish cat")
with doc.retokenize() as retok:
    retok.merge(doc[0:0])

I am not exactly sure how you are getting zero-length spans in your code, but you can check spans before merging to see if they have zero length and skip them.

Also, to make it easier for us to help you, if you'd like to share mode code, please read the Github Markdown guide and don't share screenshots of code or errors, paste them as text.

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@connersdavis
Comment options

@polm
Comment options

@connersdavis
Comment options

@polm
Comment options

Answer selected by connersdavis
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 #11322 on August 17, 2022 03:50.