Parsing
Parses board game rulebook PDFs into Markdown using
Docling, for use as source
documents in boardgame_rag.py.
This step uses its own environment, separate from the RAG pipeline's — see
environment.yml in this folder.
Usage
Run from the repo root (not from inside parsing/):
from parse_rulebook import parse
parse("catan.pdf", "catan")
# For scanned/image-based PDFs, enable OCR:
parse("betrayal_at_house_on_the_hill.pdf", "betrayal_at_house_on_the_hill", ocr=True)
parse() converts a single rulebook PDF to Markdown and writes it to parsed/.
file_name— PDF filename from<repo_root>/rulebooks/out_name— base name for the output Markdown fileocr— setTrueto run OCR (via RapidOCR) on scanned/image-based PDFs; defaults toFalse
Paths
- Reads rulebooks from
<repo_root>/rulebooks/ - Writes parsed Markdown to
<repo_root>/parsed/
The script locates the repo root via Path(__file__).resolve().parent.parent,
which assumes this file stays at <repo_root>/parsing/parse_rulebook.py. If
you move it, update that line accordingly.