https://github.com/localjo/ocr-bank
A solution for http://codingdojo.org/kata/BankOCR/
https://github.com/localjo/ocr-bank
Last synced: 2 months ago
JSON representation
A solution for http://codingdojo.org/kata/BankOCR/
- Host: GitHub
- URL: https://github.com/localjo/ocr-bank
- Owner: localjo
- Created: 2018-04-17T19:59:37.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-11-10T11:45:57.000Z (over 5 years ago)
- Last Synced: 2025-01-06T04:28:41.493Z (4 months ago)
- Language: JavaScript
- Size: 20.5 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# OCR Bank
## Installation
```bash
git clone https://github.com/localjo/ocr-bank.git
cd ocr-bank
npm install
```## Usage
```js
import fs from 'fs';
import { parseAccountFile} from 'ocr-bank';parseAccountFile(fs.readFileSync('input.txt', 'utf-8'));
```## Tests
Run tests to verify the solution:
```bash
npm test
```## TODO
This is an unfinished solution. Here's what's left to do:
### 1) Suggest alternatives for ambiguous numbers
One possible solution is to write a function that compares an ambiguous input digit to all valid digits, counts the number of pipes/underscores that are different for each one, filters them for those that have only one difference, and then returns the numerical values for those possible alternates in an array. That function could then be called on each digit in the ambiguous account number (maybe starting with illegible characters first), creating a new account number that could be run through the `validateAccountNumber()` function to see if it has a valid checksum. Valid alternative account numbers could then be pushed to an array that is appended to the result. There is one failing test case to test for this functionality, but more should be added.
### 2) Add more test cases
The tests included with this solution aren't complete. More test cases need to be added to ensure that all possible scenarios are handled, including creating tests for `parseAccountFile()` that test several potential account files, including very large files.
### 3) Improve formatting and organization of test filesAll test inputs and expected outputs could be saved to external files. Some of the test inputs are organized that way already, but outputs are not, and there could be a more elegant, async solution that uses a glob syntax to read all of the input files and check their output.