Hi,
I have a text-parsing question -
array1 = ["Joe lives in France", "Sue goes to Japan", "Hiro walked around
France", "Bill moved to England"]
a_countries = ["France", "Japan", "England", "Spain"]
desired result is unique list (hash table) of all countries mentioned in
the sentences in array1, with frequency of occurence - eg,
France 2
Japan 1
England 1
Spain 0
neither of these (below) works:
a_countries.each do |h|
x = array1.inject([]){|menu,e| menu<< h if country_list.include?(e);menu}
end
x = array1.inject([]){|menu,e| menu<< $& if /#{a_countries.each}/ =~ e;
menu}