Created
April 10, 2014 04:49
-
-
Save UberMouse/10343411 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lines = [] | |
File.open(ARGV[0]).each_line do |line| | |
lines << line | |
end | |
def word_to_num(word) | |
case word | |
when "zero" then 0 | |
when "one" then 1 | |
when "two" then 2 | |
when "three" then 3 | |
when "four" then 4 | |
when "five" then 5 | |
when "six" then 6 | |
when "seven" then 7 | |
when "eight" then 8 | |
when "nine" then 9 | |
end | |
end | |
lines.map{|l| l.split(";")}.each do |line| | |
puts line.map{|word| word_to_num(word)}.join | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment