-- -- concordance.scr -- -- @author Matthew M. Burke -- @version 1.0 -- -- This script reads the words in the file "text.txt" and -- builds a list indicating how many times each word was found -- in the text. -- -- open the file for reading. inf = openfile("text.txt", "r") -- create the word list. conc = {} -- read each word while true do res = read(inf, "*w") -- read returns nil if there is no more data in the file if res == nil then break end -- get rid of punctuation res = gsub(res, "[,._']", "") -- your code goes here end -- close the file closefile(inf) -- print the word list foreach(conc, print)