README: list data/ and repair_pipeline_package/, with usage
Browse files
README.md
CHANGED
|
@@ -14,7 +14,9 @@ pretty_name: ProseOnlyRepair — Evaluation Analysis Scripts
|
|
| 14 |
# ProseOnlyRepair — Evaluation Analysis Scripts
|
| 15 |
|
| 16 |
Anonymized evaluation/analysis scripts that reproduce the tables and
|
| 17 |
-
figures in the *Repair-First* paper (under double-blind review)
|
|
|
|
|
|
|
| 18 |
|
| 19 |
## Contents
|
| 20 |
|
|
@@ -25,6 +27,10 @@ figures in the *Repair-First* paper (under double-blind review).
|
|
| 25 |
| `build_12variant_analysis.py` | 12-variant superset including POST-only (used in appendix) |
|
| 26 |
| `make_paper_figures.py` | Regenerates Figures 1 and 2 from eval JSONs |
|
| 27 |
| `requirements.txt` | Python dependencies (lm-evaluation-harness 0.4.12, datasets <4.0, etc.) |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
## Variant naming
|
| 30 |
|
|
@@ -51,12 +57,58 @@ python3 build_12variant_analysis.py
|
|
| 51 |
python3 make_paper_figures.py
|
| 52 |
```
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
The accompanying evaluation result JSONs (12 variants × prose + paloma
|
| 55 |
suites) are released in the paper's supplementary materials zip.
|
| 56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
## Notes
|
| 58 |
|
| 59 |
-
-
|
| 60 |
- Scripts are deterministic: identical inputs → identical outputs.
|
| 61 |
- The 28-task prose suite + 11-corpus Paloma BPB panel are evaluated
|
| 62 |
with `lm-evaluation-harness==0.4.12` (vLLM backend).
|
|
|
|
| 14 |
# ProseOnlyRepair — Evaluation Analysis Scripts
|
| 15 |
|
| 16 |
Anonymized evaluation/analysis scripts that reproduce the tables and
|
| 17 |
+
figures in the *Repair-First* paper (under double-blind review), the
|
| 18 |
+
per-task results behind them (`data/`), and the implementation of the
|
| 19 |
+
ten-stage repair pipeline (`repair_pipeline_package/`).
|
| 20 |
|
| 21 |
## Contents
|
| 22 |
|
|
|
|
| 27 |
| `build_12variant_analysis.py` | 12-variant superset including POST-only (used in appendix) |
|
| 28 |
| `make_paper_figures.py` | Regenerates Figures 1 and 2 from eval JSONs |
|
| 29 |
| `requirements.txt` | Python dependencies (lm-evaluation-harness 0.4.12, datasets <4.0, etc.) |
|
| 30 |
+
| `data/results.py` | Per-task results: 27 downstream tasks and 11 Paloma corpora for each tier (HQ, MQ, LQ) and configuration (V1: surface repair; V2: surface + linguistic repair) against Raw (mean over three pre-training seeds), with noise bands, deltas and z-scores; corpus statistics, recovery yield and repair-operation shares |
|
| 31 |
+
| `data/make_tables.py` | Writes the appendix LaTeX tables (`appendix_tables.tex`, `table_anatomy.tex`, `table_summary.tex`, `appendix_analysis_tables.tex`) from `data/results.py` |
|
| 32 |
+
| `data/make_figures.py` | Writes the result figures (`figures/fig1_teaser*.pdf`, `fig3_heatmaps*.pdf`, `fig4_paloma_split.pdf`, `fig5_ops.pdf`) from `data/results.py` |
|
| 33 |
+
| `repair_pipeline_package/` | Implementation of the ten-stage repair pipeline (see below) |
|
| 34 |
|
| 35 |
## Variant naming
|
| 36 |
|
|
|
|
| 57 |
python3 make_paper_figures.py
|
| 58 |
```
|
| 59 |
|
| 60 |
+
The scripts in `data/` need no evaluation JSONs (the per-task results are in
|
| 61 |
+
`data/results.py`); run them from the repository root, and they write to it:
|
| 62 |
+
|
| 63 |
+
```bash
|
| 64 |
+
python3 data/results.py # win/loss tallies per tier and configuration
|
| 65 |
+
python3 data/make_tables.py # ./appendix_tables.tex, ./table_anatomy.tex, ./table_summary.tex, ./appendix_analysis_tables.tex
|
| 66 |
+
python3 data/make_figures.py # ./figures/*.pdf
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
The accompanying evaluation result JSONs (12 variants × prose + paloma
|
| 70 |
suites) are released in the paper's supplementary materials zip.
|
| 71 |
|
| 72 |
+
## Repair pipeline (`repair_pipeline_package/`)
|
| 73 |
+
|
| 74 |
+
The ten-stage repair pipeline in its masking-first form: mixed-content
|
| 75 |
+
masking runs before the ftfy repair.
|
| 76 |
+
|
| 77 |
+
| Path | Role |
|
| 78 |
+
|---|---|
|
| 79 |
+
| `pipeline.py` | `RepairPipeline`: runs the stages in order and keeps an audit trail of every change |
|
| 80 |
+
| `stages/stage01_encoding.py` … `stage10_restore.py` | encoding detection, masking, ftfy repair, artifact removal, line-level repair, character normalization, whitespace, OCR repair, quality validation, restoring the masked segments |
|
| 81 |
+
| `masking/` | masking of non-prose segments (DOM path, plain-text path, sentinels) |
|
| 82 |
+
| `typed_repair/` | type-specific repair of the masked code, math and structured segments |
|
| 83 |
+
| `quality/ensemble.py` | the six-tool quality ensemble |
|
| 84 |
+
| `config.py` | model paths (under `$REPAIR_MODELS_ROOT`, default `/data/models`) and thresholds |
|
| 85 |
+
| `document.py`, `run.py` | the document and audit data model; the command-line entry point |
|
| 86 |
+
|
| 87 |
+
From the repository root:
|
| 88 |
+
|
| 89 |
+
```bash
|
| 90 |
+
python -m repair_pipeline_package.run input.html -o out.jsonl # one file
|
| 91 |
+
python -m repair_pipeline_package.run ./corpus_dir -o out.jsonl # every file under a directory
|
| 92 |
+
python -m repair_pipeline_package.run scan.txt --source-hint ocr --http-charset utf-8
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
```python
|
| 96 |
+
from repair_pipeline_package import RepairPipeline
|
| 97 |
+
doc = RepairPipeline().run(raw_bytes) # doc.text, doc.quality_passed, doc.audit, ...
|
| 98 |
+
```
|
| 99 |
+
|
| 100 |
+
Output is JSONL, one document per line: `path`, `encoding`, `quality_passed`,
|
| 101 |
+
`quality_score`, `discarded`, `discard_reason`, `n_segments`, `audit`, `text`.
|
| 102 |
+
Every model and library a stage uses (fastText, LanguageTool, NLTK, SymSpell,
|
| 103 |
+
ByT5, KenLM, Magika, the masking classifiers, BeautifulSoup, ftfy) is optional:
|
| 104 |
+
when one is missing, the stage logs a warning and falls back to a heuristic or
|
| 105 |
+
skips that step. Model files go under `$REPAIR_MODELS_ROOT` at the paths in
|
| 106 |
+
`config.py`. The docstrings call the package `repair_pipeline`; use the folder
|
| 107 |
+
name as above, or rename the folder.
|
| 108 |
+
|
| 109 |
## Notes
|
| 110 |
|
| 111 |
+
- The analysis scripts are CPU-only Python and require no GPU.
|
| 112 |
- Scripts are deterministic: identical inputs → identical outputs.
|
| 113 |
- The 28-task prose suite + 11-corpus Paloma BPB panel are evaluated
|
| 114 |
with `lm-evaluation-harness==0.4.12` (vLLM backend).
|