spectre_pdf 1.0.0

Native Rust PDF extraction engine: text, markdown for RAG, AcroForm widgets, image decoding, and encrypted PDFs. Lazy parser, persistent Document handle, no C dependencies.
Documentation
"""Reverse the "marker → ML tools" over-substitution.

The original `marker` in these contexts meant delimiter/tag (PDF
content-stream operators like EI, list-item markers, CMap start/end
tokens), NOT the marker PDF library. Restore.
"""

from __future__ import annotations

import re
from pathlib import Path

ROOT = Path("/mnt/c/Users/RyanJ/spectre-rs")

# Common contexts where "marker" was the right word
PATTERNS = [
    (r"list-item ML tools", "list-item marker"),
    (r"ML tools to be a", "marker to be a"),
    (r"start ML tools", "start marker"),
    (r"end ML tools", "end marker"),
    (r"EI ML tools", "EI marker"),
    (r"EOL ML tools", "EOL marker"),
    (r"with a smaller list ML tools", "with a smaller list marker"),
    (r"\"ML tools\" comment", "\"marker\" comment"),
    (r"ML tools\b", "marker"),
]


for path in ROOT.rglob("*.rs"):
    if "target/" in str(path) or "/lopdf-fork/" in str(path):
        continue
    original = path.read_text(encoding="utf-8")
    new = original
    for pat, repl in PATTERNS:
        new = re.sub(pat, repl, new)
    if new != original:
        path.write_text(new, encoding="utf-8")
        print(f"  fixed {path.relative_to(ROOT)}")