terminalskills-chandra-ocr
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "terminalskills-chandra-ocr" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-f24799bcc10565aa40439afcb7a32b1252a26de0274b68f15102c16eb90bb784. Verify the upstream source and version against https://github.com/TerminalSkills/skills before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
github.com
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Terminalskills Chandra OCR extracts text from complex documents, capable of high-accuracy handling of tables, forms, handwriting, and whole-page layouts. It is suited for extracting data from scanned documents, reading complex tables in PDFs/images, and processing handwritten forms.
Introduction source: third_party · TerminalSkills · 1.0.0 Reference
SkillPi interpretation
- Testing
- Not tested
Browse files
Frontmatter
name: chandra-ocr
description: >-
Extract text from complex documents using Chandra OCR — handles tables, forms, handwriting,
and full page layouts with high accuracy. Use when: extracting data from scanned documents,
reading complex tables from PDFs/images, processing handwritten forms.
license: Apache-2.0
compatibility: "Python 3.10+"
metadata:
author: terminal-skills
version: "1.0.0"
category: documents
tags:
- ocr
- document-processing
- tables
- handwriting
- data-extractionChandra OCR
Extract text from complex documents — tables, forms, handwriting, and full page layouts — using Chandra, a high-accuracy OCR engine built for real-world document complexity.
Overview
Chandra OCR handles the document types that trip up standard OCR: multi-column tables with merged cells, mixed print and handwriting, and complex page layouts. It outputs structured data (DataFrames, JSON) and supports GPU acceleration for batch processing.
Instructions
Installation
pip install chandra-ocr
For GPU acceleration (recommended for batch processing):
pip install chandra-ocr[gpu]
Basic Text Extraction
from chandra import OCR
ocr = OCR()
result = ocr.read("document.png")
print(result.text)
# From a PDF
result = ocr.read("report.pdf")
for page in result.pages:
print(f"--- Page {page.number} ---")
print(page.text)
Layout-Preserved Extraction
result = ocr.read("document.png", preserve_layout=True)
for block in result.blocks:
print(f"Type: {block.type}") # paragraph, table, header, handwriting
print(f"Text: {block.text}")
print(f"Confidence: {block.confidence:.2f}")
Table Extraction
result = ocr.read("invoice.png", extract_tables=True)
for table in result.tables:
print(f"Table: {table.rows} rows x {table.cols} columns")
df = table.to_dataframe()
print(df.head())
table.to_csv("extracted_table.csv")
Handwriting Recognition
result = ocr.read("handwritten_form.jpg", mode="handwriting")
for block in result.blocks:
if block.type == "handwriting":
print(f"Handwritten: {block.text} (conf: {block.confidence:.2f})")
Mixed Documents (Print + Handwriting)
result = ocr.read("filled_form.png", mode="mixed")
for block in result.blocks:
print(f"[{block.type}] {block.text} (conf: {block.confidence:.2f})")
Batch Processing
import glob
from chandra import OCR
import json
ocr = OCR(device="cuda")
files = glob.glob("documents/*.pdf")
for file_path in files:
result = ocr.read(file_path, extract_tables=True)
output = {
"file": file_path,
"pages": len(result.pages),
"text": result.text,
"tables": [t.to_dict() for t in result.tables],
}
with open(file_path.replace(".pdf", ".json"), "w") as f:
json.dump(output, f, indent=2)
Examples
Example 1: Extract Invoice Tables to CSV
from chandra import OCR
ocr = OCR()
result = ocr.read("invoice-2025-0342.pdf", extract_tables=True)
for i, table in enumerate(result.tables):
df = table.to_dataframe()
df.to_csv(f"invoice_table_{i}.csv", index=False)
print(f"Table {i}: {table.rows} rows — columns: {list(df.columns)}")
# Output:
# Table 0: 12 rows — columns: ['Item', 'Qty', 'Unit Price', 'Total']
# Table 1: 3 rows — columns: ['Tax Type', 'Rate', 'Amount']
Example 2: Process Handwritten Medical Forms
from chandra import OCR
import requests
ocr = OCR()
result = ocr.read("patient_intake_form.jpg", mode="mixed", extract_tables=True)
extracted = {}
for block in result.blocks:
extracted[block.label] = {
"value": block.text,
"confidence": block.confidence,
"needs_review": block.confidence < 0.85,
}
review_fields = {k: v for k, v in extracted.items() if v["needs_review"]}
print(f"Fields needing review: {list(review_fields.keys())}")
# Output:
# Fields needing review: ['allergies', 'signature']
Guidelines
- Use
device="cuda"for batch processing — 5-10x faster than CPU - Set
dpi=300or higher for scanned documents to improve accuracy - For forms with checkboxes, use
mode="mixed"to detect both print and marks - Confidence threshold of 0.85 is a good default for human review routing
- Pre-process images (deskew, denoise) for better results on poor-quality scans
| Option | Default | Description |
|---|---|---|
mode |
"auto" |
Detection mode: auto, print, handwriting, mixed |
preserve_layout |
False |
Maintain spatial positioning of text |
extract_tables |
False |
Detect and extract tables as structured data |
device |
"cpu" |
Processing device: cpu or cuda |
language |
"en" |
Primary language hint |
dpi |
300 |
DPI for PDF rasterization |
Current listing version
1.0.0
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Highlights
- 支持高精度处理表格、表单、手写内容及复杂布局,解决标准 OCR 难以处理的实际问题
- 提供发票提取、医疗表单处理等端到端示例,实用性强
Highlights
- 触发描述清晰覆盖多种变体(扫描文档、PDF/图像表格、手写表单),边界明确
Areas to improve
-
description 内容重复 Reported severity: Minor
顶层 frontmatter 和 skill_body 内部均包含 description 字段,内容一致但存在冗余
Recommendation: 建议保留一处 description,避免重复
Highlights
- 文档结构完整,包含安装、基础用法、高级功能、示例和最佳实践
- 提供多种使用模式(print/handwriting/mixed)和参数说明,便于用户快速上手
Highlights
- 提供完整的 pip 安装命令及 GPU 加速选项
- 覆盖主要异常处理建议(置信度阈值、图像预处理、设备选择)
- 参数说明详细,包含默认值和用途描述
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
-
Save or modify files
Confirm the output directory and whether existing files will be replaced. Back up important files and prefer a new output directory.
Mentioned in main document · lines 120 -
Install or fetch external dependencies
Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.
Mentioned in main document · lines 34, 40
Domains or addresses referenced in the document
These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.
- github.com
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.