From e32486864aaa897f7a5ccf0f563b111f3273a212 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 29 Sep 2026 01:42:14 +0000 Subject: [PATCH] docs: say what to_networkx and compute_survival_records build to_networkx's docstring promised citation edges. It adds a "cites" edge for any fact detail containing "url=". No analyzer emits a citation URL as a fact (citation facts carry "type=added" and the like), so at brief and detailed depth the graph holds revision transitions only; at forensic depth the full_wikitext_before/after facts match, and each becomes a node holding a revision's whole wikitext. The docstring says so. compute_survival_records handles sentence events, not claim events; its docstring now says how spans are matched and censored. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01EpGaiBuSk5nCSV2hKyD6PN --- src/refract/__init__.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/refract/__init__.py b/src/refract/__init__.py index dfb846a..6d6e452 100644 --- a/src/refract/__init__.py +++ b/src/refract/__init__.py @@ -100,7 +100,12 @@ def _flatten_event(e: EvidenceEvent) -> dict[str, Any]: def compute_survival_records(events: list[EvidenceEvent]) -> list[dict[str, Any]]: - """Transform sentence/claim events into time-to-event duration records for survival analysis.""" + """Turn sentence events into time-to-event records for survival analysis. + + One record per span from sentence_first_seen or sentence_reintroduced to + sentence_removed, matched on section and the first 60 characters of the + sentence. A span with no removal is right-censored (event_observed 0). + """ from datetime import datetime records = [] first_seen: dict[str, str] = {} @@ -139,7 +144,16 @@ def compute_survival_records(events: list[EvidenceEvent]) -> list[dict[str, Any] def to_networkx(events: list[EvidenceEvent]) -> Any: - """Export citation and transition events to a NetworkX DiGraph.""" + """Build a NetworkX DiGraph of the revision transitions in events. + + Each event adds an edge rev: -> rev: carrying + its eventType and timestamp; a later event on the same pair overwrites them. + A fact whose detail contains "url=" also adds a "cites" edge from the + revision to that detail. No analyzer emits a citation URL as a fact, but at + forensic depth the full_wikitext_before/after facts contain "url=" whenever + the page cites a web source, and each becomes a node holding a revision's + whole wikitext. Pass brief or detailed events for a graph of transitions. + """ import networkx as nx # type: ignore G = nx.DiGraph() for e in events: