knowledge: PR-1 skim surfaces (KNOWLEDGE §7) #1

Merged
onibot merged 1 commits from feature/skim-pr1 into main 2026-10-20 14:52:52 +02:00
Owner

PR-1 of the skim (KNOWLEDGE.md §7) — the structural read of every fetched article, in passing, oriented to the current question AND the run goal. All deterministic, zero LLM.

What lands:

  • knowledge/skim.py: skim_article() — per-article SkimSheet (headings + term hits, table identity, infobox keys with resolved quantity values, link candidates from goal-relevant regions), built from material fetch_rich already downloads.
  • Quantity-unit patterns (find_quantities): 50 m3/s as a vocabulary-independent signal — the Italy discharge table's heading says "above 50 m3/s", never "discharge"; keyword search cannot cross that gap, the unit pattern can.
  • wiki.resolve_convert wired into _clean_cell: {{convert|N|unit}} → "N unit" before the generic template pass — the unit-loss bug (captions/cells cleaned to bare numbers) is fixed at the root.
  • WikiPage.wikitext stored by fetch_rich (the infobox surface — Adige's discharge1_avg lives there, invisible to the plain extract and parse_tables).
  • _process_page: gated chunks RANKED by skim signals instead of first-N-in-document-order.

Verified: live smoke on real Wikipedia (Italy sheet surfaces table 2, 27 rows, discharges 1540/350/239/235 m3/s with units in the caption; Adige sheet surfaces discharge1_avg = 235 m3/s). Tests: 6 new, suite 35/35.

Why: Run G (Italy, log-10) failed honestly-empty with the answer already fetched. PR-2 (opportunistic harvest + seen-index) and PR-3 (skim notices to the machine) follow on this design. Docs commit: b85f196 (KNOWLEDGE §7 + RUNLOG Run G).

**PR-1 of the skim (KNOWLEDGE.md §7)** — the structural read of every fetched article, in passing, oriented to the current question AND the run goal. All deterministic, zero LLM. What lands: - `knowledge/skim.py`: `skim_article()` — per-article SkimSheet (headings + term hits, table identity, infobox keys with resolved quantity values, link candidates from goal-relevant regions), built from material `fetch_rich` already downloads. - Quantity-unit patterns (`find_quantities`): `50 m3/s` as a vocabulary-independent signal — the Italy discharge table's heading says "above 50 m3/s", never "discharge"; keyword search cannot cross that gap, the unit pattern can. - `wiki.resolve_convert` wired into `_clean_cell`: `{{convert|N|unit}}` → "N unit" before the generic template pass — the unit-loss bug (captions/cells cleaned to bare numbers) is fixed at the root. - `WikiPage.wikitext` stored by `fetch_rich` (the infobox surface — Adige's `discharge1_avg` lives there, invisible to the plain extract and `parse_tables`). - `_process_page`: gated chunks RANKED by skim signals instead of first-N-in-document-order. Verified: live smoke on real Wikipedia (Italy sheet surfaces table 2, 27 rows, discharges 1540/350/239/235 m3/s with units in the caption; Adige sheet surfaces `discharge1_avg = 235 m3/s`). Tests: 6 new, suite 35/35. Why: Run G (Italy, log-10) failed honestly-empty with the answer already fetched. PR-2 (opportunistic harvest + seen-index) and PR-3 (skim notices to the machine) follow on this design. Docs commit: b85f196 (KNOWLEDGE §7 + RUNLOG Run G).
onibot added 1 commit 2026-10-20 14:52:47 +02:00
The Italy run (Run G) failed with the data in hand: Q1's LIST ingest
early-exited on the length table and discarded the same article's 27-row
discharge table; the Adige/Tiber discharges live in infobox templates,
invisible to both the plain extract and parse_tables; and {{cvt|50|m3/s}}
cleaned to "50" — units silently dropped everywhere.

PR-1 builds the skim's surfaces and signals (deterministic, zero LLM):

- knowledge/skim.py: skim_article() builds a per-article SkimSheet —
  section headings with term hits, table identity (caption/headers/row
  count), infobox parameter keys with resolved quantity values, link
  candidates from goal-relevant regions — from material fetch_rich
  already downloads.
- quantity-unit patterns (find_quantities): "50 m3/s" is a
  vocabulary-independent signal; the Italy discharge section's heading
  says "above 50 m3/s", never "discharge" — this finds what keyword
  search cannot.
- wiki.resolve_convert: {{convert|N|unit}} resolves to "N unit" inside
  _clean_cell BEFORE the generic template pass (which kept only the first
  argument and dropped the unit). Captions and cells keep units.
- WikiPage.wikitext: fetch_rich stores the raw source (infobox surface).
- _process_page: gated chunks are RANKED by skim signals (question + goal
  terms + quantity patterns) instead of first-N in document order.

Live smoke (real Wikipedia, no LLM): the Italy sheet shows table 2
"Rivers of Italy above 50 m3/s of average flow at the mouth", 27 rows,
quantities 50/350/239/235/187/170 m3/s; the Adige sheet shows infobox
discharge1_avg = 235 m3/s.

Tests: 6 new (knowledge/tests/skim.py), suite 35/35 green.
PR-2 (opportunistic harvest + seen-index) and PR-3 (notices to the
machine) follow.
onibot merged commit 12786cfc25 into main 2026-10-20 14:52:52 +02:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: onibot/floop#1