It is simple and fast to count all the occurrences of a word in a body of text by, say,
Code: Select all
repeat for each word tWord in tText
add 1 to myArray[tWord]
end repeat
The real issue here is that to use an array to advantage, there must be a "chunk" of two words. Otherwise LC has to assemble a construct on its own, which, though readily doable, takes more effort and much more runtime.
In other words, might there be a use for a custom chunk:
With this, you could:set the customChunk to "has fleas"
Code: Select all
repeat for each customChunk in tText
add 1 to myArray["my dog"]
or
add 1 to myArray[the customChunk]
end repeat