概要
LiteParse はスタンドアロンの PDF 解析ツールで、バウンディングボックス付きの空間テキスト解析、柔軟な OCR システムを提供し、複数の出力フォーマットをサポートします。ローカルで動作し、Rust、Node.js、Python および WASM と統合できます。
README プレビュー
# LiteParse\n\n[](https://github.com/run-llama/liteparse/actions/workflows/ci.yml)\n|\n[](https://crates.io/crates/liteparse)\n|\n[](https://www.npmjs.com/package/@llamaindex/liteparse)\n|\n[](https://www.npmjs.com/package/@llamaindex/liteparse-wasm)\n|\n[](https://pypi.org/project/liteparse/)\n|\n[](https://opensource.org/licenses/Apache-2.0)\n|\n[Docs](https://developers.llamaindex.ai/liteparse/)\n\n\n\n> Looking for LiteParse V1? Follow this link to [the old code](https://github.com/run-llama/liteparse/tree/logan/liteparse-v1)\n\nLiteParse is a standalone OSS PDF parsing tool focused exclusively on **fast and light** parsing. It provides high-quality spatial text parsing with bounding boxes, without proprietary LLM features or cloud dependencies. Everything runs locally on your machine.\n\n**Hitting the limits of local parsing?**\nFor complex documents (dense tables, multi-column layouts, charts, handwritten text, or\nscanned PDFs), you'll get significantly better results with [LlamaParse](https://developers.llamaindex.ai/python/cloud/llamaparse/?utm_source=github&utm_medium=liteparse),\nour cloud-based document parser built for production document pipelines. LlamaParse handles the\nhard stuff so your models see clean, structured data and markdown.\n\n> [Sign up for LlamaParse free](https://cloud.llamaindex.ai?utm_source=github&utm_medium=liteparse)\n\n## Overview\n\n- **Fast Text Parsing**: Spatial text parsing using PDFium\n- **Flexible OCR System**:\n - **Built-in**: Tesseract (zero setup, bundled with the library)\n - **HTTP Servers**: Plug in any OCR server (EasyOCR, PaddleOCR, custom)\n - **Standard API**: Simple, well-defined OCR API specification\n- **Screenshot Generation**: Generate high-quality page screenshots for LLM agents\n- **Multiple Output Formats**: JSON and Text\n- **Bounding Boxes**: Precise text positioning information\n- **Multi-language**: Use from Rust, Node.js/TypeScript, Python, or the browser (WASM)\n- **Multi-platform**: Linux, ma
FAQ (5)
トラブル対応liteparse が TextItem の x と y に PDF points ではなくグリッド投影座標を返すのはなぜでしょうか?
liteparse v2.0.0-beta.2 では、TextItem.x および TextItem.y が誤ってグリッド投影座標(文字列と行インデックス)に設定されており、PDF ポイント座標ではありません。これは既知のバグです。回避策として、dev CLI ツールを使用して生の PDF ポイント座標を抽出してください:
python -m liteparse.cli extract --pdf-path <your_pdf.pdf>
このコマンドは、正しい x、y、width、height と追加のメタデータを含む投影前のアイテムを返します。チームは恒久的な修正に取り組んでおり、今後のリリースに備えてリポジトリを確認してください。
ハウツーCloudflare Workersやエッジランタイム上でLiteParseを使用してPDFを解析する方法
@llamaindex/liteparse-wasm パッケージを使用します。これは、Cloudflare Workers、Deno Deploy、Vercel Edge、ブラウザと互換性のあるWebAssemblyベースのPDFパーサーを提供します。npm install @llamaindex/liteparse-wasm でインストールし、PDFパーサーを直接インポートします。使用例についてはパッケージのREADMEを確認してください。元のNode.js依存のliteParseパッケージは、ネイティブモジュールのためエッジランタイムをサポートしていません。
トラブル対応ネイティブテキストを含むPDFページで、LiteParseが日本語、中国語、または韓国語のOCRテキストを「chart labels」として破棄してしまう問題を修正する方法
これは @llamaindex/liteparse 2.15.0 のバグです。crates/liteparse/src/ocr_merge.rs において、is_chart_label は 3 文字以下のすべての OCR トークンをチャートラベルとして扱います。Tesseract は中国語、日本語、韓国語のテキストを 1〜3 文字の単語に分割することが多いため、CJK の文章画像が誤分類されます。ページにネイティブテキストも含まれる場合、chart_like_images はその後画像の OCR を破棄し、LITEPARSE_DEBUG_OCR=1 では skip(chart-figure) として表示されます。
修正: PR #498 を含むリリースにアップグレードしてください。この修正では、短いトークンの長さルールを CJK 文字を含まないトークンにのみ適用し、数値ラベルの検出は維持されます。ソースからビルドする場合は、CJK トークンが文字数が <= 3 であるという理由だけでラベルとしてマークされないように、is_chart_label にパッチを適用してください。
以下で確認してください:
LITEPARSE_DEBUG_OCR=1 lit parse repro.pdf --ocr-language jpn --format json -q
修正後、CJK の OCR 行は skip(chart-figure) ではなく ADD として表示されるはずです。一時的な回避策として、ネイティブテキストのないページで CJK 画像を処理するか、パッチ適用済みのビルドを使用してください。
トラブル対応Windows で Office ドキュメントを変換する際に、`lit parse` が `Conversion("Command failed: ")` で失敗するのはなぜですか?
Windows上のlit 2.0.1では、LibreOfficeのユーザープロファイルURIがfile://C:\\Users\\...として誤って生成されますが、LibreOfficeは3つのスラッシュとフォワードスラッシュを使用したfile:///C:/Users/...を必要とします。このため、sofficeが終了コード1で終了したり、stderrへの出力なしにハングしたりします。回避策として、まずOfficeドキュメントを手動でPDFに変換し、その後そのPDFをパースしてください:
soffice --headless --invisible --convert-to pdf --outdir ./out input.docx
lit parse ./out/input.pdf --format text -o output.md
sofficeによる直接変換は、litの不正な形式の一時プロファイルURIを使用しないため、正常に動作します。
トラブル対応liteparse OCRを使用する際の'tessdata/eng.traineddata'エラーを修正する方法は?
TESSDATA_PREFIX 環境変数を、tessdata 言語ファイルが格納されているディレクトリに設定します。
1. https://github.com/tesseract-ocr/tessdata/raw/main/eng.traineddata から eng.traineddata をダウンロードします。
2. 任意のフォルダ(例: Windows では C:\\tessdata、Linux では /usr/share/tessdata)に配置します。
3. TESSDATA_PREFIX をそのフォルダのパスに設定します:
- Windows: $env:TESSDATA_PREFIX='C:\\tessdata'
- Linux/macOS: export TESSDATA_PREFIX=/usr/share/tessdata
liteparse が Tesseract をバンドルしている場合、tessdata フォルダは node_modules/@llamaindex/liteparse/tessdata にある可能性があります。その場合は、変数をそのパスに設定してください。