{"id":49235660,"url":"https://github.com/r-uben/socr","last_synced_at":"2026-04-24T15:33:29.857Z","repository":{"id":330048442,"uuid":"1121408413","full_name":"r-uben/socr","owner":"r-uben","description":"Multi-engine OCR with cascading fallback, quality audit, and figure extraction","archived":false,"fork":false,"pushed_at":"2026-04-11T18:04:08.000Z","size":941,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-11T19:27:30.179Z","etag":null,"topics":["deepseek","document-processing","gemini","nougat","ocr","pdf"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/r-uben.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-23T00:23:42.000Z","updated_at":"2026-04-11T18:04:12.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/r-uben/socr","commit_stats":null,"previous_names":["r-uben/ocr-agent","r-uben/smart-ocr","r-uben/socr"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/r-uben/socr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-uben%2Fsocr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-uben%2Fsocr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-uben%2Fsocr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-uben%2Fsocr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/r-uben","download_url":"https://codeload.github.com/r-uben/socr/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/r-uben%2Fsocr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32228998,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T13:21:15.438Z","status":"ssl_error","status_checked_at":"2026-04-24T13:21:15.005Z","response_time":64,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deepseek","document-processing","gemini","nougat","ocr","pdf"],"created_at":"2026-04-24T15:33:29.336Z","updated_at":"2026-04-24T15:33:29.845Z","avatar_url":"https://github.com/r-uben.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# socr\n\n[![PyPI](https://img.shields.io/pypi/v/socr)](https://pypi.org/project/socr/)\n[![Python 3.11–3.12](https://img.shields.io/pypi/pyversions/socr)](https://pypi.org/project/socr/)\n[![License](https://img.shields.io/github/license/r-uben/socr)](LICENSE)\n\nMulti-engine document OCR with cascading fallback and quality audit.\n\n`socr` orchestrates multiple OCR engines — calling each as a CLI subprocess, auditing output quality, and falling back to a different engine when results are poor. Each engine is a standalone CLI tool (`gemini-ocr`, `deepseek-ocr`, `marker-ocr`, etc.) that can also be used independently.\n\n## Install\n\n```bash\npip install socr\n\n# With specific engine backends\npip install socr[gemini]          # Google Gemini (cloud)\npip install socr[local]           # DeepSeek + Nougat (local/free)\npip install socr[all]             # All engines\n```\n\nEngines are installed separately because they have different dependencies (torch, cloud SDKs, etc.). Install only what you need.\n\n## Usage\n\n```bash\n# Process a PDF\nsocr paper.pdf\n\n# Choose engine\nsocr paper.pdf --primary gemini\nsocr paper.pdf --primary marker\n\n# Save extracted figures\nsocr paper.pdf --save-figures\n\n# Batch process a directory\nsocr batch ~/Papers/ -o ./results/\nsocr batch ~/Papers/ --dry-run        # preview what would be processed\nsocr batch ~/Papers/ --reprocess      # force reprocess all\n\n# Check which engines are available\nsocr engines\n```\n\n## How it works\n\n```\nPDF → Primary OCR → Quality Audit → (Fallback OCR if needed) → Markdown\n```\n\n1. **Primary OCR** — Calls the primary engine CLI on the whole PDF\n2. **Quality audit** — Heuristic checks (word count, garbage ratio, repetition)\n3. **Fallback** — If audit fails, tries a different engine\n\nEach engine is a separate CLI binary. `socr` calls it as a subprocess, reads the output markdown, and applies the quality pipeline.\n\n## Engines\n\n| Engine | Package | Type | Notes |\n|--------|---------|------|-------|\n| Gemini | `gemini-ocr-cli` | Cloud | Google Gemini, ~$0.0002/page |\n| Mistral | `mistral-ocr-cli` | Cloud | Mistral AI |\n| Marker | `marker-ocr-cli` | Local | Layout-aware (Surya + Texify) |\n| DeepSeek | `deepseek-ocr-cli` | Local | Via Ollama |\n| Nougat | `nougat-ocr-cli` | Local | Academic papers, Python \u003c3.13 |\n\nCheck availability:\n```\n$ socr engines\n\n  [+] gemini       cloud, ~$0.0002/page\n  [+] marker       local, layout-aware (Surya + Texify)\n  [+] mistral      cloud, ~$0.001/page\n  [+] deepseek     local via Ollama\n  [x] nougat       local, academic papers\n```\n\n## CLI reference\n\n```\nsocr process \u003cPDF\u003e [OPTIONS]\n  -o, --output-dir PATH       Output directory\n  --primary ENGINE             Primary OCR engine (gemini, marker, deepseek, etc.)\n  --fallback ENGINE            Fallback engine\n  --no-audit                   Skip quality audit\n  --save-figures               Save extracted figure images\n  --timeout SECONDS            Subprocess timeout (default: 300)\n  --profile NAME               Load ~/.config/socr/{name}.yaml\n  --config PATH                Custom YAML config file\n  -q, --quiet                  Suppress non-error output\n  -v, --verbose                Verbose output\n  --dry-run                    List files without processing\n  --reprocess                  Force reprocess already-done files\n\nsocr batch \u003cDIR\u003e [OPTIONS]\n  Same options as process, plus:\n  --limit N                    Process first N files\n\nsocr engines                   Show available engines\n```\n\n## Output\n\n```\noutput/\u003cdoc_stem\u003e/\n├── \u003cdoc_stem\u003e.md        # OCR text\n├── metadata.json        # Processing stats\n└── figures/             # With --save-figures\n    └── figure_1_page3.png\n```\n\n## Configuration\n\nCreate `~/.config/socr/config.yaml`:\n\n```yaml\nprimary_engine: gemini\nfallback_engine: marker\ntimeout: 300\nsave_figures: false\naudit_enabled: true\naudit_min_words: 50\n```\n\nOr use profiles: `~/.config/socr/fast.yaml` → `socr paper.pdf --profile fast`\n\n## Engine CLIs\n\nEach backend is an independent CLI tool:\n\n- [gemini-ocr-cli](https://github.com/r-uben/gemini-ocr-cli) — Google Gemini\n- [deepseek-ocr-cli](https://github.com/r-uben/deepseek-ocr-cli) — DeepSeek via Ollama\n- [mistral-ocr-cli](https://github.com/r-uben/mistral-ocr-cli) — Mistral AI\n- [marker-ocr-cli](https://github.com/r-uben/marker-ocr-cli) — Marker (Surya + Texify)\n- [nougat-ocr-cli](https://github.com/r-uben/nougat-ocr-cli) — Meta Nougat\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-uben%2Fsocr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fr-uben%2Fsocr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fr-uben%2Fsocr/lists"}