File size: 2,371 Bytes
f57dfbb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# scripts/

## `otsl_norm.py` — the canonicaliser

HTML → **PaddleOCR-VL 1.6's own OTSL convention**. This is what produced the
`otsl` column of the shards.

```python
import sys; sys.path.insert(0, ".")
from otsl_norm import html_to_otsl

otsl = html_to_otsl(html)          # canonical OTSL
```

Rules it implements (they mirror
`paddlex/inference/pipelines/paddleocr_vl/uilts.py::otsl_parse_texts`, the
parser PaddleOCR-VL 1.6 uses at inference time):

* cell origin → `<fcel>` + text, or `<ecel>` when the cell is empty;
* colspan → `<lcel>` in the **same row**, to the right;
* rowspan → `<ucel>` in the row(s) **below**, in the same column;
* merged both ways → `<xcel>`;
* rows are **not** padded — a row lists the cells it actually has;
* cell text: leading/trailing whitespace stripped, internal whitespace runs
  collapsed to a single space.

Self-check (parses its own output back with the official parser and compares
cell by cell):

```bash
python3 validate_otsl_norm.py <pack_dir> 3000   # -> 99.77% identical
```

## `canonical_teds.py` — the scorer

The table scorer used for the reference runs. Primary metric is **TEDS-S**;
`text_profile="canonical"` (the default) flattens tags, decodes entities,
converts LaTeX to Unicode and collapses whitespace on both sides.

Note: for *pure-structure* tables (every cell empty, e.g. `sprint_mustard`)
TEDS is undefined and only TEDS-S is meaningful.

## `build_norm_pack.py` — rebuild the ground truth of a pack

```bash
python3 build_norm_pack.py --src <old_pack> --out <new_pack> --workers 8
```

Rebuilds the `otsl` column from the `html` column. It keeps the **source**
OTSL instead whenever the HTML in that pack is only a shell (all cells empty,
the text living in the source annotation) — otherwise the text would be lost.
Set `POVL_` env vars are not needed here; the rule is hard-coded and logged
per shard.

## `compare_runs.py` — paired comparison of two runs

```bash
python3 compare_runs.py --a <run_tag> --b <run_tag> --out report.json
```

Pairs the two runs **by sample id** and reports per-cohort deltas with a
paired bootstrap CI. Use the `合计(配对同 id, n=…)` line for the headline
number; the `合计(按样本)` line compares A's own sample set against B's own
sample set, which mixes two different populations when the two runs were
scored on different subsets.