1- # Instructions
1+ Optical Character Recognition or OCR is software that converts images of text into machine-readable text.
2+ Given a grid of characters representing some digits, convert the grid to a string of digits.
3+ If the grid has multiple rows of cells, the rows should be separated in the output with a ` "," ` .
24
3- Given a 3 x 4 grid of pipes, underscores, and spaces, determine which number is represented, or whether it is garbled.
5+ * The grid is made of one of more lines of cells.
6+ * Each line of the grid is made of one or more cells.
7+ * Each cell is three columns wide and four rows high (3x4) and represents one digit.
8+ * Digits are drawn using pipes (` "|" ` ), underscores (` "_" ` ), and spaces (` " " ` ).
49
5- ## Step One
10+ ## Edge cases
611
7- To begin with, convert a simple binary font to a string containing 0 or 1.
12+ * If the input is not a valid size, your program should indicate there is an error.
13+ * If the input is the correct size, but a cell is not recognizable, your program should output a ` "?" ` for that character.
814
9- The binary font uses pipes and underscores, four rows high and three columns wide.
15+ ## Examples
1016
11- ``` text
12- _ #
13- | | # zero.
14- |_| #
15- # the fourth row is always blank
16- ```
17-
18- Is converted to "0"
19-
20- ``` text
21- #
22- | # one.
23- | #
24- # (blank fourth row)
25- ```
26-
27- Is converted to "1"
28-
29- If the input is the correct size, but not recognizable, your program should return '?'
30-
31- If the input is the incorrect size, your program should return an error.
32-
33- ## Step Two
34-
35- Update your program to recognize multi-character binary strings, replacing garbled numbers with ?
36-
37- ## Step Three
38-
39- Update your program to recognize all numbers 0 through 9, both individually and as part of a larger string.
40-
41- ``` text
42- _
43- _|
44- |_
17+ The following input (without the comments) is converted to ` "1234567890" ` .
4518
4619```
47-
48- Is converted to "2"
49-
50- ``` text
5120 _ _ _ _ _ _ _ _ #
52- | _| _||_||_ |_ ||_||_|| | # decimal numbers.
21+ | _| _||_||_ |_ ||_||_|| | # Decimal numbers.
5322 ||_ _| | _||_| ||_| _||_| #
54- # fourth line is always blank
23+ # The fourth line is always blank,
5524```
5625
57- Is converted to "1234567890"
26+ The following input is converted to ` "123,456,789" ` .
5827
59- ## Step Four
60-
61- Update your program to handle multiple numbers, one per line.
62- When converting several lines, join the lines with commas.
63-
64- ``` text
28+ ```
6529 _ _
6630 | _| _|
6731 ||_ _|
@@ -75,5 +39,3 @@ When converting several lines, join the lines with commas.
7539 ||_| _|
7640
7741```
78-
79- Is converted to "123,456,789".
0 commit comments