Skip to content

error token/spans (spacy/tokens/doc.cpp:4890) #450

@ahelaatabi

Description

@ahelaatabi

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,

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBugs and behaviour differing from documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions