Git Product home page Git Product logo

ocr-bank's Introduction

OCR Bank

Installation

git clone https://github.com/localjo/ocr-bank.git
cd ocr-bank
npm install

Usage

import fs from 'fs';
import { parseAccountFile} from 'ocr-bank';

parseAccountFile(fs.readFileSync('input.txt', 'utf-8'));

Tests

Run tests to verify the solution:

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 files

All 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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.