惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

爱范儿
爱范儿
量子位
大猫的无限游戏
大猫的无限游戏
小众软件
小众软件
J
Java Code Geeks
B
Blog
V
V2EX
博客园 - 三生石上(FineUI控件)
Blog — PlanetScale
Blog — PlanetScale
aimingoo的专栏
aimingoo的专栏
Y
Y Combinator Blog
F
Fortinet All Blogs
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
The Cloudflare Blog
A
About on SuperTechFans
D
DataBreaches.Net
阮一峰的网络日志
阮一峰的网络日志
博客园 - Franky
H
Help Net Security
宝玉的分享
宝玉的分享
Martin Fowler
Martin Fowler
酷 壳 – CoolShell
酷 壳 – CoolShell
MongoDB | Blog
MongoDB | Blog
L
LangChain Blog

Hacker News: Show HN

PurrrrrFocus: Pomodoro Timer App - App Store Workflow Engine — Multi-Step Orchestration for Bun RapidPhoto: Pro Photo Editor App - App Store GitHub - DheerG/swarms: Achieve extraordinary results with claude code across a variety of tasks SPICE simulation → oscilloscope → verification with Claude Code — Lucas Gerads Show HN: VCoding – A 5 MB native Windows IDE with no dynamic dependencies Show HN: LLMs don't hallucinate because they're bad at math, it's the format GitHub - Agent-FM/agentfm-core: AgentFM is a peer-to-peer network that turns everyday computers into a decentralized AI supercomputer. AgentFM lets you run massive AI workloads directly across a global mesh of idle CPUs and GPUs. Show HN: Tracking Top US Science Olympiad Alumni over Last 25 Years GitHub - Potarix/agent-hub: One place to talk to all your agents Show HN: Runtime security for AI agents(injection,tool abuse, data exfiltration) GitHub - dubeyKartikay/lazyspotify: Terminal Spotify client for macOS and Linux GitHub - the-banana-tool/king-louie: Easy to use GUI Personal AI Assistant. Win/Linux/Mac. Show HN I made my vacation rental bookable by AI agents–no Airbnb, 0% commission GitHub - basteez/jsf-autoreload: maven plugin to enable hot reload on jsf projects uvm32/hosts/host-gdbstub at main · ringtailsoftware/uvm32 GitHub - labsai/EDDI: Config-driven engine that turns JSON into production-grade AI agents. Multi-agent orchestration, 12+ LLM providers, MCP/A2A protocols, RAG, persistent memory, and enterprise compliance (EU AI Act, GDPR, HIPAA). Built on Quarkus. GitHub - glitchnsec/fortyone-oss: AI Executive Assistant Platform Quickstart | Alien GitHub - muxshed/shed: One stream in, or many. Every destination, simultaneously. No cloud middleman, no per-channel fees, no limits. GitHub - ocrbase-hq/ocrbase: 📄 PDF/IMG ->.MD/JSON Document OCR API for PaddleOCR and GLMOCR. Self-hostable. GitHub - impactjo/home-memory: MCP server that lets your AI assistant remember everything about your home. GitHub - Sets88/dbcls: DbCls is a powerful terminal database client that supports various databases GitHub - neptun2000/heor-agent-mcp GitHub - SeanFDZ/macmind: Single-layer transformer in HyperTalk for the classic Macintosh RollQuation: Math Puzzles - Apps on Google Play GitHub - dropbox/witchcraft Show HN: Agent-cache – Multi-tier LLM/tool/session caching for Valkey and Redis GitHub - opentalon/opentalon: OpenTalon is an open-source platform built from the ground up in Go as a robust alternative to OpenClaw LinkedIn™ 职位抓取工具 - Chrome 应用商店
GitHub - EwanValentine/pdf2context: A Golang CLI for conv...
vegancap · 2026-05-09 · via Hacker News: Show HN

Buy Me A Coffee

A production-quality CLI tool that converts directories of PDF files into chunked JSONL context files suitable for use with large language models and retrieval-augmented generation (RAG) pipelines.

Features

  • Recursive PDF discovery
  • Text extraction via pdftotext (preserves layout)
  • Automatic OCR fallback via ocrmypdf + Tesseract when text yield is low
  • Text cleaning: header/footer removal, Unicode normalisation, control-char stripping
  • Configurable overlapping word chunks
  • Per-file .context.jsonl output + optional combined file
  • Processing manifest (manifest.json) with full statistics
  • Live Bubble Tea TUI with worker status, progress bar, ETA, and recent log

Requirements

macOS

brew install poppler ocrmypdf tesseract

Linux (Debian/Ubuntu)

apt-get install poppler-utils ocrmypdf tesseract-ocr

Build

# Using make
make

# Or directly
go build -o pdf2context .

Install to $GOPATH/bin

make install
# or
go install .

Usage

# Process all PDFs in a directory with defaults
pdf2context /path/to/pdfs

# Use 8 workers, smaller chunks, no combined output
pdf2context /path/to/pdfs --workers 8 --chunk-size 800 --overlap 80 --no-combined

# Increase OCR timeout for large scanned documents
pdf2context /path/to/pdfs --ocr-timeout 20m

# Verbose mode
pdf2context /path/to/pdfs --verbose

Flags

Flag Default Description
--workers 4 Number of parallel worker goroutines
--chunk-size 1200 Words per chunk
--overlap 100 Word overlap between consecutive chunks
--ocr-timeout 10m Per-file OCR timeout
--min-words 50 Trigger OCR when extracted word count is below this
--no-combined false Skip writing combined.context.jsonl
--verbose false Verbose output

Output Format

Per-file: <original>.pdf.context.jsonl

Each line is a JSON object:

{
  "source": "quarterly_report.pdf",
  "path": "/path/to/quarterly_report.pdf",
  "chunk": 0,
  "text": "This is the first chunk of extracted text ...",
  "word_count": 1200
}

Combined: combined.context.jsonl

All records from all PDFs concatenated into a single JSONL file in the input directory.

Manifest: manifest.json

{
  "generated_at": "2024-01-15T10:30:00Z",
  "input_dir": "/path/to/pdfs",
  "total_pdfs": 46,
  "processed_ok": 44,
  "total_chunks": 312,
  "failed_files": [
    {
      "path": "/path/to/corrupted.pdf",
      "error": "pdftotext failed: exit status 1"
    }
  ],
  "ocr_stats": {
    "files_ocrd": 8
  },
  "processing_ms": 187432
}