index attribute for sentences #4899
-
Feature descriptionAlthough technically they are Spans (which do not have indices per se), it would be nice to somehow access the indices of a Doc's sentences: perhaps by having the generator supply a tuple containing the index. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
Sentences aren't internally stored as a list, so providing an index in the What you could do though, is loop through all the sentences in |
Beta Was this translation helpful? Give feedback.
-
|
I'll do that - thanks! |
Beta Was this translation helpful? Give feedback.
Sentences aren't internally stored as a list, so providing an index in the
docis not straightforward and implementing a function like this would not be efficient.What you could do though, is loop through all the sentences in
list(doc.sents)once, set a custom extension to the correspondingSpan, and use that in your other functions.