title: How to get the index of a token in a sentence in spaCy?
body: <p>Is there an elegant way to get the index of a word/token in its sentence?
  I am aware of the attributes for tokens <a href="https://spacy.io/api/token#attributes" rel="nofollow noreferrer">https://spacy.io/api/token#attributes</a>
  The <code>i</code> attribute returns the index within the whole parent document. But the parent document can contain multiple sentences.</p>
  <p>Example:</p>
  <blockquote>
  <p>&quot;This is an example. This is another example.&quot;</p>
  </blockquote>
  <p>What I need is both <code>&quot;This&quot;</code> to be returned as index <code>0</code>, both <code>&quot;is&quot;</code> to be returned as index <code>1</code> etc...</p>