Apug98's picture
Create README.md
9c3c0f9 verified
|
Raw
History Blame Contribute Delete
1.17 kB
# Parsing
Parses board game rulebook PDFs into Markdown using
[Docling](https://github.com/docling-project/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/`):
```python
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 file
- `ocr` — set `True` to run OCR (via RapidOCR) on scanned/image-based PDFs;
defaults to `False`
## 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.