Skip to main content

T-OCR Library

This is a Python library that contains methods for easy and fast OCR parsing with various tools. Used to read scanned PDF documents and images with text.


Key Features

  1. File parsing is done in the AWS cloud, eliminating the need for additional dependencies on your machine.

  2. Parsing of each page is done in parallel in AWS, resulting in a significantly faster parsing process.

  3. Access to the T-OCR AWS part is required to use the library.

  4. Combines the best OCR tools and provides a consistent interface, making it easy to use and switch between tools.

    # Parsing with Tesseract (Free OCR)
    free_ocr = FreeOCR()
    pages = free_ocr.read_pdf("1.pdf")
    for page in pages:
        print(page.full_text)
    # Parsing with Textract
    textract = Textract()
    pages = textract.read_pdf("1.pdf")
    for page in pages:
        print(page.full_text)
  5. The package contains a large number of powerful methods that will help you save time and read parsed data faster and better.

    # Get dates etc. from text
    date_matches = get_valid_dates("Text - February 17, 2009, text...")  # 02/17/2009
    
    # Compare the real text with what the OCR read
    does_strings_match_by_fuzzy("Apple", "Appla", percentage=0.8)  # True
    does_text_contains_string_by_fuzzy("Apple", "Appla watch", percentage=0.8) # True
    
    text = "Long article about Appla watch"
    find_string_in_text_by_fuzzy("Apple", text, percentage=0.8)  # 19
  6. Caching OCR results locally in t_ocr_cache folder is supported. Use this during development to avoid blocking parsing time.

    pdf_file = "file.pdf"
    # First run
    free_ocr.read_pdf("1.pdf", cache_data=True) # Takes 15 seconds
    # Every next run
    free_ocr.read_pdf("1.pdf", cache_data=True) # Takes 0.01 seconds
    
    # If the state of the file or arguments changes, it will save the cache for this call too
    free_ocr.read_pdf("1.pdf", dpi=500, cache_data=True) # Takes 15 seconds
    free_ocr.read_pdf("1.pdf", dpi=500, cache_data=True) # Takes 0.01 seconds

Supported OCR Tools

1. Tesseract (Free OCR)

  • 🆓 Free

  • ✅ Read text

  • ❌ Read tables, vertical field values

  • ⬛ Simple form design preferred

2. AWS Textract

  • 💸 Paid

  • ✅ Read text

  • ✅ Read tables, vertical field values

  • 🌃 Flexible for different file designs

Metadata

Release files for t-ocr 1.5.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for t-ocr 1.5.6
File Size Uploaded
t_ocr-1.5.6.tar.gz 27.7 kB Details

Release files / t_ocr-1.5.6.tar.gz

Download URL t_ocr-1.5.6.tar.gz
Size 27.7 kB
Tags Source
SHA-256 checksum
How to use checksums
18dfc63949b5c08aec25414fcaaf7adc787198965ed798a7eca5255810dcce0b
BLAKE2b-256 checksum
How to use checksums
6cb377f18639a08657ea5669f4475d46e54ab6d80ae0bf536c87d3b43fa0a266
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.5

Release history Release notifications | RSS feed

This release

1.5.6 This release

1 release file

1.5.5

1 release file

1.5.4

1 release file

1.5.3

1 release file

1.5.2

1 release file

1.5.1

1 release file

1.5.0

1 release file

1.4.22

1 release file

1.4.21

1 release file

1.4.20

1 release file

1.4.19

1 release file

1.4.18

1 release file

1.4.17

1 release file

1.4.16

1 release file

1.4.15

1 release file

1.4.14

1 release file

1.4.13

1 release file

1.4.12

1 release file

1.4.11

1 release file

1.4.10

1 release file

1.4.9

1 release file

1.4.8

1 release file

1.4.7

1 release file

1.4.6

1 release file

1.4.5

1 release file

1.4.3

1 release file

1.4.2

1 release file

1.4.1

1 release file

1.4.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page