def using_split2(line, _len=len):
    words = line.split()
index = line.index
offsets = []
append = offsets.append
running_offset = 0
for word in words:
    word_offset = index(word, running_offset)
word_len = _len(word)
running_offset = word_offset + word_len
append((word, word_offset, running_offset - 1))
return offsets
How to split a string on whitespace and retain offsets and lengths of words