Skip to content
Discussion options

You must be logged in to vote

No, this isn't a bug. Token.children returns a generator, not a list, so when you try to iterate over it the second time it's empty.

Most of the Doc and Token properties that can potentially end up iterating over a lot of data return generators rather than lists. But to be honest some of the details aren't quite 100% consistent in the API (Doc.ents returns a tuple while Doc.sents returns a generator), so it can be a good idea to check the docs to be sure: https://spacy.io/api/token#children

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ines
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