Basically, the script does a string.find on a large piece of text (500
words-ish - sometimes more) for occurrences of any word from a list of
over 40,000.
At the moment, I'm going through a table which contains the 40,000
"check words" and performing this string.find on each one.
How about extracting the words in the text and then see if they're one of
the "check words"? You'll need to invert the table you have, but that's
easy:
function invert(t)
local z={}
for k,v in pairs(t) do z[v]=true end
return z
end
I see where you're going with that - and it's a great idea. However, the difficulty comes when the "check word" is actually a "check phrase", eg: two or three words.
I would have to split the document text up and compare each word against the inverted table, but how would I split it up? If I split it into single words, it wouldn't work.
Thanks anyway!