The last part you are looking for is simple.
Just set up a list and check if the word is in it or not.
set ignoreList to {"to", "is"}
set reportFile to "/Users/USERNAME/Desktop/Word Frequencies.txt"
set theTextFile to "Users/USERNAME/Desktop/foo.txt")
set word_list to every word of (do shell script "cat " & quoted form of theTextFile)
set word_frequency_list to {}
repeat with the_word_ref in word_list
set the_current_word to contents of the_word_ref
if the_current_word is not in ignoreList then
set word_info to missing value
repeat with record_ref in word_frequency_list
if the_word of record_ref = the_current_word then
set word_info to contents of record_ref
exit repeat
end if
end repeat
if word_info = missing value then
set word_info to {the_word:the_current_word, the_count:1}
set end of word_frequency_list to word_info
else
set the_count of word_info to (the_count of word_info) + 1
end if
end if
end repeat
--return word_frequency_list
set the_report_list to {}
repeat with word_info in word_frequency_list
set end of the_report_list to quote & the_word of word_info & ¬
quote & " - appears " & the_count of word_info & " times."
end repeat
set AppleScript's text item delimiters to return
set the_report to the_report_list as text
do shell script "echo " & quoted form of the_report & " > " & quoted form of reportFile
set AppleScript's text item delimiters to ""
delay 1
do shell script " open " & quoted form of reportFile
I have also changed some of the code to use shell script to read/write the file. Only because I prefer using it rather than Textedit.