Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#!/usr/bin/env ruby1.9
# -*- coding: utf-8 -*-
require 'ripper'
result ={ |h,k| h[k] = 0 }\s/).each{ |file|
Ripper.tokenize(open(file, "r:utf-8").read).each{ |token|
result[token] += 1
result.to_a.sort_by{ |pair| pair[1] }.reverse.each{ |pair|
token, count = *pair
puts "#{count} #{token.inspect}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.