-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
error token/spans (spacy/tokens/doc.cpp:4890) #450
Copy link
Copy link
Closed
Labels
bugBugs and behaviour differing from documentationBugs and behaviour differing from documentation
Description
Hey,
I came across this error :
if token.nbor(i=1) : File "spacy/tokens/token.pyx", line 94, in spacy.tokens.token.Token.nbor (spacy/tokens/token.cpp:4699) return self.doc[self.i+i] File "spacy/tokens/doc.pyx", line 100, in spacy.tokens.doc.Doc.__getitem__ (spacy/tokens/doc.cpp:4890) if self._py_tokens[i] is not None: IndexError: list index out of range
What I was trying to do is run this small:
for sent in doc.sents: for token in sent: if token.nbor(i=1) : print token,token.nbor(i=1)
The purpose of this small code was to merge in the "doc" span the consecutive nouns <the ones with tag have 'NN'>. All this before passing it to a relation extraction algorithm.
Thanks in advance,
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugBugs and behaviour differing from documentationBugs and behaviour differing from documentation