Sophie

Sophie

distrib > Mandriva > 2006.0 > x86_64 > by-pkgid > 4fb2bf23211d5f27ae943c283575a23a > files > 176

ruby-doc-1.8.2-7.5.20060mdk.x86_64.rpm

# word occurrence listing
# usege: ruby occur2.rb file..
freq = {}
while gets()
  for word in split(/\W+/)
    begin
      freq[word] += 1
    rescue NameError
      freq[word] = 1
    end
  end
end

for word in freq.keys.sort
  printf("%s -- %d\n", word, freq[word])
end