Skip to content

Commit 50a5deb

Browse files
committed
Measure the page's median font over text, not over blocks
The median font of a page is meant to say how big ordinary body text is; every header heuristic is stated as a multiple of it. It was taken over blocks, one vote each, so a crowd of tiny figure labels and axis ticks outvoted the body. 10890106 lands on 6.1pt against a 72pt title, which makes "title font" (1.4x median = 8.5pt) true of every block on the poster: the test says nothing at all there. Weighting each block by its length measures the body, which is what the multiples were chosen against. This is the root cause behind three patches attempted and rejected first (all in the history, none worth re-running blind): admitting large top-zone text as title fragments, scaling the block-gap threshold to local line height, and keeping banner furniture out of col_start. The last one is the tell - it made 10890106 WORSE, because a tight col_start was the only thing holding a meaningless title-font test in check. Widening the cutoff let the byline and legend become headers too. Fixing the measure removes the need to compensate for it. 10890106 Study design 0.595 to 0.962, and its rField finally moves (+0.029) after several attempts that could not touch it. 4552067 +0.096, gasimova +0.013. Against that AISec2025 gives up 0.038, on a GT section labelled "Conclusion" that holds a GitHub repo name, its URL and a figure caption; the repo name now heads its own block, away from the URL. Corpus rField 0.737 to 0.741 (0.729 at session start), w 0.976, rGlobal 0.835, 20/21, 12/13 numbered, 13/13 logic-OK, suite green (260 passed), every affiliation string in the corpus unchanged and verified. Unchanged: gasimova's title (0.706), whose cause is _flatten_top_band dissolving a real two-column banner, not this measure.
1 parent 317d8a9 commit 50a5deb

2 files changed

Lines changed: 26 additions & 16 deletions

File tree

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"id": "10890106",
2020
"w": 0.948,
2121
"r_global": 0.684,
22-
"r_field": 0.713,
22+
"r_field": 0.742,
2323
"fields": [
2424
[
2525
"title",
@@ -43,7 +43,7 @@
4343
],
4444
[
4545
"S:Study design",
46-
0.595,
46+
0.962,
4747
26
4848
],
4949
[
@@ -53,7 +53,7 @@
5353
],
5454
[
5555
"S:Results: characterization MUTZ-3 d",
56-
0.625,
56+
0.61,
5757
55
5858
],
5959
[
@@ -545,7 +545,7 @@
545545
"id": "4552067",
546546
"w": 0.994,
547547
"r_global": 0.97,
548-
"r_field": 0.777,
548+
"r_field": 0.873,
549549
"fields": [
550550
[
551551
"title",
@@ -554,7 +554,7 @@
554554
],
555555
[
556556
"authors+affiliations",
557-
0.025,
557+
1.0,
558558
1
559559
],
560560
[
@@ -569,7 +569,7 @@
569569
],
570570
[
571571
"S:Network of Experts",
572-
0.968,
572+
0.859,
573573
77
574574
],
575575
[
@@ -1011,7 +1011,7 @@
10111011
"id": "AISec2025-poster",
10121012
"w": 0.987,
10131013
"r_global": 0.908,
1014-
"r_field": 0.811,
1014+
"r_field": 0.773,
10151015
"fields": [
10161016
[
10171017
"title",
@@ -1020,12 +1020,12 @@
10201020
],
10211021
[
10221022
"authors+affiliations",
1023-
0.636,
1023+
0.696,
10241024
15
10251025
],
10261026
[
10271027
"S:Introduction",
1028-
0.707,
1028+
0.873,
10291029
148
10301030
],
10311031
[
@@ -1040,12 +1040,12 @@
10401040
],
10411041
[
10421042
"S:Conclusion",
1043-
0.857,
1043+
0.4,
10441044
12
10451045
],
10461046
[
10471047
"S:Selected papers citing CyberLLMIns",
1048-
0.969,
1048+
0.936,
10491049
128
10501050
]
10511051
],
@@ -1178,7 +1178,7 @@
11781178
"id": "gasimova(oos)",
11791179
"w": 0.966,
11801180
"r_global": 0.9,
1181-
"r_field": 0.784,
1181+
"r_field": 0.797,
11821182
"fields": [
11831183
[
11841184
"title",
@@ -1217,12 +1217,12 @@
12171217
],
12181218
[
12191219
"S:Conclusion",
1220-
0.686,
1220+
0.883,
12211221
106
12221222
],
12231223
[
12241224
"S:Contact",
1225-
0.359,
1225+
0.28,
12261226
30
12271227
]
12281228
],

poster2json/extract.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -927,8 +927,18 @@ def extract_text_with_pdfplumber(pdf_path: str) -> Optional[str]:
927927
if not all_blocks:
928928
continue
929929

930-
all_fontsizes = [blk["fontsize"] for blk in all_blocks if blk["fontsize"] > 0]
931-
page_median_fs = sorted(all_fontsizes)[len(all_fontsizes) // 2] if all_fontsizes else 0
930+
# The median font of a page means the size of typical TEXT, not of
931+
# a typical block. Taking it per-block let a crowd of tiny figure
932+
# labels and axis ticks outvote the body: 10890106 lands on 6.1pt
933+
# against a 72pt title, so "title font" (1.4x median = 8.5pt) is
934+
# true of every block on the poster and the test says nothing.
935+
# Weighting each block by its length measures the body instead.
936+
weighted_fs = []
937+
for blk in all_blocks:
938+
if blk["fontsize"] > 0:
939+
weighted_fs.extend([blk["fontsize"]] * max(1, len(blk["text"])))
940+
page_median_fs = (sorted(weighted_fs)[len(weighted_fs) // 2]
941+
if weighted_fs else 0)
932942

933943
text_left = min(blk["hpos"] for blk in all_blocks)
934944
text_right = max(blk["hpos"] + blk["width"] for blk in all_blocks)

0 commit comments

Comments
 (0)