How to measure how many tokens between specific types - NLTK / Python3.x

Viewed 10

So I'm interested in seeing if there is any way to measure how many tokens apart are particular types I'm interested in. For example, this is part of the text I am working with and the marked types are the ones I am interested in measuring in two ways:

a)how many tokens in average are there between all of them? (Manually, I can calculate it 0+18+12=30/3= 10)

b)how many tokens are exactly between Abuser and the first Social-Media, for instance. (Manually I can count them and see that there are 18)

... die ihre Abuser out-callen und teils sogar exposen mit Fotos aber nicht nur was die TäterInnen angeht auch was Hilfsangebote angeht scheint Social-Media immer wichtiger zu werden Es gibt zum Beispiel ein Handzeichen dass auf Social-Media viel geteilt wurde...

As you can probably tell, I'm not that experienced (yet) with Python/NLTK but I'm trying my best, so any answers/help is greately appreciated. I have all of the types I want to measure already as a list, but I just can't get to answering how to 'measure' things how I want to.

Thank you all for your time in answering this! :)

0 Answers
Related