Say if I have a sentence:
a fox jumps over another fox
I need to map it to a list of words with their corresponding range inside the string, for example, the first "fox" should map to:
["fox", NSRange(2, 3)]
the difficulty here is duplicated words like the two "fox", I can check the index of each word in the string, and remove the word (from the string) as I go, but is there a smarter way of doing this?
Another challenge is when a word has dot in it, say:
a fox jumps over another f.x
if I search the range for "f.x" probably it would also match "fox"?
Thanks!