Is there an elegant way to get the index of a word/token in its sentence?
I am aware of the attributes for tokens https://spacy.io/api/token#attributes
The i
attribute returns the index within the whole parent document. But the parent document can contain multiple sentences.
Example:
"This is an example. This is another example."
What I need is both "This"
to be returned as index 0
, both "is"
to be returned as index 1
etc...