I am assuming its dictionary/array where the text is stored and you want to count words in text, not id so it would be iterator's value not key.
But then if this word appears twice in one iterator's value it would add 1 to variable anyway
Maybe there should be some kind of text manipulation integrated into that to check how many times word appears in each key's value first? And then save it under another integer and just add them at the end.
I'll think about it. Unless someone has it already figured out