Thanks Matt for the (quick) follow-up
first snippets work well. Second do not. I get the following error message :
/Users/gauvins/Desktop/test.rb:1:in `require': no such file to load -- appscript (LoadError)
I stumbled upon your post searching for a way to do exactly what you did in your example (count instances of words in a list). The (few) applescripts examples I could locate seemed very inefficient. An Applescript based app chokes on the large file I used to test the procedure (close to 1G ...).
I understand that Rb-script could be immensely superior, but I would rather try to use your code as some kind of external function, for the moment at least. Maybe this summer I can find the time to rewrite.