Socket
Book a DemoInstallSign in
Socket

ocr_challenge

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ocr_challenge

1.0
bundlerRubygems
Version published
Maintainers
1
Created
Source

Business Card OCR Challenge - defined here

Overview

This gem allows you to take a new line delimited String, and pull out names, email addresses, and phone numbers. The String input can come from a file, STDIN, the output of another program, etc.

This concept has been specifically applied to business cards, but can easily be used more generically.

Installation

gem install ocr_challenge

or in your Gemfile

gem 'ocr_challenge'

Usage

1.) Create a contact with your input String

require 'ocr_challenge'
include OcrChallenge

text = """
    Alexander Vanadio\n
    execdd17@gmail.com\n
    (123)-456-7890\n
"""

contact = IBusinessCardParser.get_contact_info(text)

2.) Get the information through your contact instance

contact.get_name            # =>  "Name: Alexander Vanadio"
contact.get_email_address   # => "Email: execdd17@gmail.com"
contact.get_phone_number    # => "Phone: 123-456-7890"

contact.to_s # => "Name: Alexander Vanadio\nEmail: execdd17@gmail.com\nPhone: 123-456-7890"

Advanced Usage

Let's use a more complicated String input. The IBusinessCard parser will attempt to find all email addresses and phone numbers, but not fax numbers. Once it does, you can get them directly from your IContactInfo instance.

require 'ocr_challenge'
include OcrChallenge

text = """
    Alexander Vanadio\n
    Software Engineer
    My Company Name
    execdd17@gmail.com\n
    anotherEmail@gmail.com\n
    Phone: 1-(123)-456-7890\n
    Cell: 123.444.7890\n
    Fax: 892-234-5467
"""

contact = IBusinessCardParser.get_contact_info(text)

contact.to_s # => "Name: Alexander Vanadio\nEmail: anotherEmail@gmail.com\nEmail: execdd17@gmail.com\nPhone Number: 123-444-7890\nPhone Number: 123-456-7890\n"

# you can also access the names, email_addresses, and phone_numbers directly
contact.names
contact.email_addresses
contact.phone_numbers

Running Tests and Code Coverage

cd orc_challenge
rspec
firefox coverage/index.html

FAQs

Package last updated on 07 Dec 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.