ubershmekel avatar ubershmekel committed fb909ab

Added support for miles and ounces. Soon the more test cases will be parsed
from the log.

Comments (0)

Files changed (3)

 When someone is translating the imperial units to metric units - don't be redundant.
 http://www.reddit.com/r/science/comments/pptts/worlds_tiniest_chameleon_discovered/c3rfi4k?context=3
 
+A number after a "foot" is probably inches:
+http://www.reddit.com/r/nba/comments/pq3vw/jeremy_lin_hits_game_winner_against_raptors_right/c3rfp7x?context=3
+

make_test_cases_from_log.py

+"""
+parse examples:
+
+2012-02-14 14:06:27,503 [INFO] title: Whats 6 inches long and WON'T be getting sucked on Valentines day? 
+2012-02-14 14:06:27,505 [INFO] link: http://www.reddit.com/r/toosoon/comments/poz6p/whats_6_inches_long_and_wont_be_getting_sucked_on/
+2012-02-14 14:06:27,505 [INFO] tresponse: 6 inches = 15.24 centimeters
+
+
+2012-02-14 14:44:47,520 [INFO] body: A guy did that at the supermarket I used to work at once.
+
+Well, I say he did that. What happened was I was working some overtime at night helping to stack a metric shit-ton (no pun intended) of toilet paper in a promotion area. I had 8 pallets of it to pile up. I got it to be about 7 feet high by 10 feet wide by 5 feet deep. Took me 3 hours.
+
+Just as I finished at 2:30am, some drunk came barrelling up and launched himself at my creation. I just stood there, speechless. That twat eventually dug himself out and looked at me. I must have looked pretty distraught, because he apologised before sheepishly walking out.
+2012-02-14 14:44:47,526 [INFO] comment: http://www.reddit.com/r/fffffffuuuuuuuuuuuu/comments/po7j6/and_i_was_never_allowed_back_in/c3r381i
+2012-02-14 14:44:47,526 [INFO] cresponse: 7 feet = 2.13 meters
+
+
+
+"""
+
+import re
+
+for line in open('2012-02-15_metricbot.py.log').readlines():
+    
     'inch': quantities.inch,
     'gallon': quantities.gallon,
     'gallons': quantities.gallon,
+    'miles': quantities.mile,
+    'mile': quantities.mile,
     'mph': MPH,
+    'oz': quantities.oz,
+    'ounce': quantities.oz,
+    'ounces': quantities.oz,
 }
 
 SI_UNITS = {
     quantities.lb: quantities.kg,
     quantities.inch: quantities.cm,
     quantities.gallon: quantities.liter,
+    quantities.mile: quantities.km,
+    quantities.oz: quantities.gram,
     MPH: KPH,
 }
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.