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
// Repetition primitives: for each normalized text token, the pages and Y-buckets
// where it appears. Used by `GeometryStats` to derive header/footer zones and
// exposed for diagnostic / data-science use.
//
// See `docs/P2/core/design-flows/2026-04-28-document-analytics-and-header-footer-classification.md`
// (Block 03). Block 03 fills in the observation and zone-derivation logic.
use HashMap;
use ;
// Note: Block 03 will introduce `HashSet` when zone-derivation logic lands.
// Don't import it yet — keep the stub clean.
/// Y-bucket index for repetition detection. Granularity controlled by
/// downstream config (default plus-or-minus 3pt bucket width).
pub type YBucket = i32;
/// Document-level repetition primitive: for each normalized text token, the
/// pages and Y-buckets where it appears. Used by `GeometryStats` to derive
/// `header_zone`/`footer_zone` and exposed for diagnostic / data-science use.
/// Per-token repetition record. `occurrences` carries the raw page x
/// y-bucket pairs; the rest are derived rollups consumed by zone detection.
/// One observation of a token at a particular page and y-bucket.