Unique Marketing, Guaranteed Results.

Chuck’s Ruby Indexer

May 22nd, 2009 by Chuck Wood

I was messing around with ruby a little and decided to write a little indexer that would tell me what the most common words were in my files. It’s really kind of a dumb program, but it was interesting what it turned out when I ran it against my code. The most common word was frequently the word ‘the.’ ‘the’ is not a commonly used variable or function in Ruby. So I looked at my code and realized that it was heavily commented, yielding frequent ‘the’s.

That being said, I’m curious to see what other people find running the indexer against their code. You can get it at http://github.com/woody2shoes/indexer/tree/master. Please comment and let me know what your code looks like.

Here’s the output from one of my rails controllers:

'school' appears 69 times in signup_controller.rb
'campus' appears 61 times in signup_controller.rb
'the' appears 52 times in signup_controller.rb
'id' appears 47 times in signup_controller.rb
'params' appears 42 times in signup_controller.rb
'end' appears 24 times in signup_controller.rb
'session' appears 23 times in signup_controller.rb
'to' appears 23 times in signup_controller.rb
'save' appears 21 times in signup_controller.rb
'user' appears 20 times in signup_controller.rb
'information' appears 19 times in signup_controller.rb
'commit' appears 17 times in signup_controller.rb
'domain' appears 17 times in signup_controller.rb
'campuses' appears 16 times in signup_controller.rb
'if' appears 16 times in signup_controller.rb
'action' appears 15 times in signup_controller.rb
'enrollment' appears 15 times in signup_controller.rb
'redirect' appears 15 times in signup_controller.rb
'find' appears 15 times in signup_controller.rb
'post' appears 14 times in signup_controller.rb
'programs' appears 14 times in signup_controller.rb
'get' appears 13 times in signup_controller.rb
'is' appears 11 times in signup_controller.rb
'this' appears 11 times in signup_controller.rb
'name' appears 10 times in signup_controller.rb
'by' appears 10 times in signup_controller.rb
'go' appears 10 times in signup_controller.rb
'yes' appears 10 times in signup_controller.rb
'form' appears 10 times in signup_controller.rb
'info' appears 10 times in signup_controller.rb
'next' appears 9 times in signup_controller.rb
'contact' appears 9 times in signup_controller.rb
'variables' appears 8 times in signup_controller.rb
'7' appears 8 times in signup_controller.rb
'program' appears 8 times in signup_controller.rb
'submission' appears 8 times in signup_controller.rb
'new' appears 8 times in signup_controller.rb
'for' appears 7 times in signup_controller.rb
'title' appears 7 times in signup_controller.rb
'requirements' appears 7 times in signup_controller.rb
'update' appears 7 times in signup_controller.rb
'all' appears 7 times in signup_controller.rb
'step' appears 7 times in signup_controller.rb
'we' appears 7 times in signup_controller.rb
'up' appears 6 times in signup_controller.rb
'a' appears 6 times in signup_controller.rb
'valid' appears 6 times in signup_controller.rb
'campusprogram' appears 6 times in signup_controller.rb
'else' appears 5 times in signup_controller.rb
'set' appears 5 times in signup_controller.rb
'in' appears 5 times in signup_controller.rb
'conditions' appears 5 times in signup_controller.rb
'elsif' appears 5 times in signup_controller.rb
'lead' appears 5 times in signup_controller.rb
'back' appears 4 times in signup_controller.rb
'no' appears 4 times in signup_controller.rb
'values' appears 4 times in signup_controller.rb
'populate' appears 4 times in signup_controller.rb
'pre' appears 4 times in signup_controller.rb
'include' appears 4 times in signup_controller.rb
'primary' appears 4 times in signup_controller.rb
'site' appears 4 times in signup_controller.rb
'merge' appears 4 times in signup_controller.rb
'about' appears 3 times in signup_controller.rb
'1' appears 3 times in signup_controller.rb
'collects' appears 3 times in signup_controller.rb
'another' appears 3 times in signup_controller.rb
'fields' appears 3 times in signup_controller.rb
'or' appears 3 times in signup_controller.rb
'signup' appears 3 times in signup_controller.rb
'each' appears 3 times in signup_controller.rb
'cp' appears 3 times in signup_controller.rb
's' appears 3 times in signup_controller.rb
'create' appears 3 times in signup_controller.rb
'attributes' appears 3 times in signup_controller.rb
't' appears 2 times in signup_controller.rb
'haven' appears 2 times in signup_controller.rb
'first' appears 2 times in signup_controller.rb
'i' appears 2 times in signup_controller.rb
'initialize' appears 2 times in signup_controller.rb
'zips' appears 2 times in signup_controller.rb
'direct' appears 2 times in signup_controller.rb
'clause' appears 2 times in signup_controller.rb
'codes' appears 2 times in signup_controller.rb
'errors' appears 2 times in signup_controller.rb
'unless' appears 2 times in signup_controller.rb
'who' appears 2 times in signup_controller.rb
'applies' appears 2 times in signup_controller.rb
'0' appears 2 times in signup_controller.rb
'complete' appears 2 times in signup_controller.rb
'as' appears 1 times in signup_controller.rb
'class' appears 1 times in signup_controller.rb
'n' appears 1 times in signup_controller.rb
'wizard' appears 1 times in signup_controller.rb
'movement' appears 1 times in signup_controller.rb
'default' appears 1 times in signup_controller.rb
'associate' appears 1 times in signup_controller.rb
'applicationcontroller' appears 1 times in signup_controller.rb

Comments are also welcome regarding ways I can parse the data to find other relevant trends in the code.

  • Facebook
  • Google Bookmarks
  • email
  • NewsVine
  • Slashdot
  • Technorati
  • Yahoo! Buzz
  • BlinkList
  • Print
  • Propeller
Filed under: Programming — Tags: , , — Chuck Wood @ 10:59 am on May 22, 2009

No Comments

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment


Copyright © 2005-2010 PMA Media Group. All Rights Reserved . Online Degrees | Train for a Better Career | My Colleges and Careers Site Map