AI

ドキュメントAI比較:Docling vs Unstructured vs LlamaParse でPDF/Wordを構造化する

オープンソースラボ編集部2026年6月14日

ドキュメントAI比較:Docling vs Unstructured vs LlamaParse でPDF/Wordを構造化する

📄 PDFや非構造化ドキュメントをLLMが処理できる構造化テキストに変換するツール。Docling・Unstructured・LlamaParseを比較します。

ドキュメントAIツールとは

PDF・Word・PowerPoint・HTMLなどの非構造化ドキュメントを、LLMやRAGシステムが扱いやすいMarkdown・JSON等に変換するパイプラインです。

主要ツール比較表

項目DoclingUnstructuredLlamaParse
ライセンスMITApache 2.0SaaS(無料枠)
セルフホスト×
PDF精度
OCR
テーブル抽出
ローカル処理×
速度◎(クラウド)
出力形式Markdown/JSONJSON/HTML/MDMarkdown/JSON
LangChain統合

各ツールの特徴

Docling

IBM Research が開発したOSSのドキュメント変換ライブラリ。DocLayNetという独自の深層学習モデルでPDFのレイアウトを高精度に解析します。

主な特徴:

  • DocLayNetモデルでレイアウト解析(ヘッダー・表・図・本文の区別)
  • EasyOCRで画像ベースのPDFにも対応
  • Markdownへの高品質変換
  • 表の構造を保持したJSON/Markdownエクスポート
from docling.document_converter import DocumentConverter

converter = DocumentConverter()

# PDFを変換
result = converter.convert("report.pdf")

# Markdownとして出力
print(result.document.export_to_markdown())

# JSON形式で出力(表の構造を保持)
doc_json = result.document.export_to_dict()

# 複数ファイルをバッチ処理
from pathlib import Path

results = converter.convert_all([
    "doc1.pdf",
    "doc2.docx",
    "doc3.html"
])

for result in results:
    md = result.document.export_to_markdown()
    Path(f"output/{result.input.file.stem}.md").write_text(md)
# LangChainとの統合
from langchain_community.document_loaders import DoclingLoader

loader = DoclingLoader(file_path="technical_spec.pdf")
documents = loader.load()

# RAGパイプラインに投入
from langchain.text_splitter import RecursiveCharacterTextSplitter
splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=200)
chunks = splitter.split_documents(documents)

向いているケース: 高精度PDF解析・ローカル処理・RAGパイプライン

Unstructured

多様なファイル形式(PDF・Word・Excel・HTML・Email等)を処理できるOSSのドキュメント処理ライブラリ。

主な特徴:

  • 25以上のファイル形式に対応(PDF/DOCX/PPTX/HTML/EML等)
  • Partition(要素分割)とChunking(チャンク化)の2段階処理
  • ローカル・API・DockerすべてでHIが使用可能
  • LangChain/LlamaIndex公式の統合
from unstructured.partition.pdf import partition_pdf
from unstructured.staging.base import convert_to_dict

# PDFを要素ごとに分割
elements = partition_pdf(
    filename="financial_report.pdf",
    strategy="hi_res",           # 高精度モード(OCR+レイアウト解析)
    infer_table_structure=True,  # 表の構造を保持
    extract_images_in_pdf=True,  # 画像も抽出
)

# 要素ごとに処理
for element in elements:
    print(element.category, element.text[:100])
    # → Title: 2024年度 決算報告書
    # → Table: | 売上高 | 1,200億円 | ...
    # → NarrativeText: 当期の売上高は...

# JSON形式にエクスポート
data = convert_to_dict(elements)

# Emailファイルの処理
from unstructured.partition.email import partition_email
email_elements = partition_email(filename="inbox.eml")

向いているケース: 多様なファイル形式・バッチ処理・エンタープライズ

LlamaParse

LlamaIndex社のクラウドドキュメントパーサー。特に複雑なPDFの表・数式・グラフを高精度で変換します。

主な特徴:

  • 複雑な財務報告書・技術仕様書のPDF解析に強い
  • カスタムプロンプトで出力フォーマットを指定
  • LlamaIndexとのネイティブ統合
  • 無料プランで1000ページ/日まで
import os
from llama_parse import LlamaParse
from llama_index.core import SimpleDirectoryReader

os.environ["LLAMA_CLOUD_API_KEY"] = "llx-xxxx"

# パーサー設定
parser = LlamaParse(
    result_type="markdown",
    num_workers=4,
    verbose=True,
    language="ja",  # 日本語
    parsing_instruction='''
    財務報告書を解析してください。
    - 表は必ずMarkdown形式で保持
    - 数値は正確に
    - セクション見出しを保持
    '''
)

# ファイル読み込み(複数ファイル対応)
file_extractor = {".pdf": parser}
documents = SimpleDirectoryReader(
    "documents/",
    file_extractor=file_extractor
).load_data()

# RAGに投入
from llama_index.core import VectorStoreIndex
index = VectorStoreIndex.from_documents(documents)
query_engine = index.as_query_engine()
response = query_engine.query("2024年の営業利益はいくらですか?")

向いているケース: 複雑な財務PDF・LlamaIndex使用中・高精度重視

選択ガイド

状況推奨
ローカル処理・高精度PDFDocling
多様なファイル形式・バッチUnstructured
複雑PDF・LlamaIndex使用中LlamaParse

内部リンク

外部リソース

FAQ

Q. スキャンされたPDF(画像PDFなど)にも対応していますか?

3ツールともOCRを内蔵しており画像PDFに対応しています。Docling(EasyOCR)・Unstructured(tesseract)・LlamaParse(クラウドOCR)の順で精度が高いです。

Q. 日本語のPDFはうまく処理できますか?

DoclingはマルチリンガルOCRをサポート。UnstructuredはTesseractの日本語パッケージ(tesseract-ocr-jpn)が必要。LlamaParseはlanguage="ja"を指定します。

Q. テーブルのデータを正確にCSVとして抽出できますか?

LlamaParseとUnstructuredは表構造の保持が特に優れています。DoclingもMarkdownテーブル形式での出力をサポートしています。

Q. 大量のPDFをバッチ処理するにはどれがいいですか?

UnstructuredはDockerコンテナとAPIが整備されており、大規模バッチ処理に向いています。Doclingも複数ファイルのバッチAPI(convert_all)をサポートしています。

他の記事も読む

Let's Build Together

OSS導入、自社だけで悩まない。

ツール選定から構築・運用・AI活用まで、オープンソースラボ運営元のClasslessが伴走します。初回のご相談は無料です。