A couple of quick notes about this solution.
-
This was tested with ruby 1.9.3 on OSX. Theres really only one dependency, rspec. Gemfile included. Feel free to run them with
rspec specs
-
Unless explicitly stated, I tried to assume input is correct. I opted for minimal edge case validation for the purposes of keeping the implementation simple and easy to review.
-
To run, you can
./run_ocr.rb recommended_test_cases.txt
-
Purely by coincidence:
$ cat *.rb | wc -l
56
$ wc -l recommended_test_cases.txt
56