Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AgenticParser

AgenticParser parses Markdown, PDF, and DOCX files into a unified intermediate representation, applies auditable cleanup rules, and exports clean Markdown with JSON reports.

Features

  • Unified IR for documents, pages, blocks, and spans.
  • Rule-based cleanup with traceable policy decisions.
  • Markdown, PDF, and DOCX input support.
  • Page inspection metadata for PDF/DOCX workflows.
  • Quality scoring and issue reports.
  • Single-file and batch parsing commands.

Installation

Install the package in editable mode:

pip install -e .

For PDF parsing, install the optional PDF dependency:

pip install -e ".[pdf]"

For local source execution without installation:

$env:PYTHONPATH="src"

Basic Usage

Parse one document:

python -m agentic_parser parse `
  path\to\input.md `
  --memory memory\rules `
  --out outputs\latest

Parse a PDF or DOCX file the same way:

python -m agentic_parser parse `
  path\to\input.pdf `
  --memory memory\rules `
  --out outputs\latest

Batch parse a directory:

python -m agentic_parser parse-batch `
  path\to\documents `
  --memory memory\rules `
  --out outputs\batch

Outputs

Each parse run writes:

  • parsed.md: cleaned Markdown.
  • parsed.ir.json: full intermediate representation.
  • report.json: applied rules, issues, backend report, and quality score.

Batch parsing also writes:

  • batch_summary.json: status and score summary for each file.

Rules

Rules are Markdown files in memory/rules/ with TOML frontmatter.

Example:

id = "drop_strike_text_contract"
priority = 100
action = "drop_span"
reason = "Drop obsolete revision text."

[scope]
doc_family = "contract"

[trigger]
style = "strike"

Supported actions:

  • drop_span
  • drop_block

Common trigger fields:

  • block_type
  • style
  • text_contains

Common scope fields:

  • doc_family
  • template_cluster

CLI Options

Useful options:

  • --backend: choose plain-markdown, pdf, or docx; defaults to auto.
  • --doc-family: pass a document family used by scoped rules.
  • --revision-agent: use none or heuristic.
  • --memory: path to rule files.
  • --out: output directory.

Python API

from pathlib import Path

from agentic_parser.pipeline import run_parse_pipeline

result = run_parse_pipeline(
    input_path=Path("path/to/input.md"),
    memory_dir=Path("memory/rules"),
    doc_family="contract",
)

print(result.markdown)
print(result.report())

Tests

$env:PYTHONPATH="src"
python -m unittest discover -s tests

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages