Skip to content

Instantly share code, notes, and snippets.

@stuckinthecloud
stuckinthecloud / TextAnalyzer-Final
Created September 21, 2011 19:06
Final Refactor
Dir.glob("files/*.txt").each do |text_file| # Iterate through all text files
text = File.read(text_file)
basename = File.basename(text_file, '.txt').capitalize.gsub('_', ' ')
sentences = text.gsub(/\s+/, ' ').strip.split(/\.|\?|!/)
@stuckinthecloud
stuckinthecloud / gist:1227555
Created September 19, 2011 20:46
Refractored TextAnalyzer
We couldn’t find that file to show.
@stuckinthecloud
stuckinthecloud / gist:1218144
Created September 14, 2011 23:52
TextAnalyzer
We couldn’t find that file to show.