monocr

package module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 14, 2026 License: MIT Imports: 11 Imported by: 0

README

monocr (Go SDK)

Mon language OCR library for Go, using ONNX Runtime.

Installation

go get github.com/MonDevHub/monocr-onnx/go

Features

  • Static Assets: Bundled charset for zero-config deployments.
  • Auto-Caching: Intelligent model download and management.
  • Native Efficiency: Direct bindings to ONNX Runtime via CGO.
  • Unified API: Synchronized logic with JS and Python SDKs.

Quick Start

package main

import (
    "fmt"
    "github.com/MonDevHub/monocr-onnx/go"
)

func main() {
    text, err := monocr.ReadImage("document.jpg")
    if err != nil {
        panic(err)
    }
    fmt.Println(text)
}

API Documentation

monocr.ReadImage(path string)

Primary entry point for image-based OCR.

monocr.ReadPDF(path string)

Full-page PDF recognition with automatic segmentation.

monocr.ReadImages(paths []string)

Batch processing for image sequences.


Prerequisites

The Go SDK requires the ONNX Runtime shared library (libonnxruntime.so or equivalent) to be present in the system's library path. See our Installation Guide for platform-specific details.

Maintenance

Maintained by MonDevHub.

License

MIT

The model monocr.onnx is automatically downloaded to ~/.monocr/models/. The charset.txt is embedded in the binary.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadImage

func ReadImage(imagePath string) (string, error)

ReadImage recognizes text from an image file. It automatically downloads the model if not present.

func ReadImageWithAccuracy

func ReadImageWithAccuracy(imagePath, groundTruth string) (string, float64, error)

ReadImageWithAccuracy recognizes text and calculates accuracy against ground truth.

func ReadImageWithModel

func ReadImageWithModel(imagePath, modelPath, charset string) (string, error)

ReadImageWithModel allows specifying custom model and charset paths.

func ReadImages

func ReadImages(imagePaths []string) ([]string, error)

ReadImages recognizes text from multiple image files.

func ReadPDF

func ReadPDF(pdfPath string) ([]string, error)

ReadPDF recognizes text from a PDF file (requires pdftoppm/poppler-utils).

func ReadPDFs

func ReadPDFs(pdfPaths []string) ([][]string, error)

ReadPDFs recognizes text from multiple PDF files.

Types

This section is empty.

Directories

Path Synopsis
cmd
monocr command
examples
pdf command
simple command
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL