Skip to content

std.provenance

Generated by sema doc from stdlib/sema/provenance.sema. Import with from std.provenance import …. For a narrative introduction see std.provenance.

std.provenance — citation id mapping + rewrite (design ⑥).

Assign each unique source URL a stable global id (first-seen order) and rewrite a result’s local [n] citation markers to those global ids. Replaces a hand-rolled _build_url_to_id_mapping + _rewrite_text_with_global_ids.

Fields

field type descriptor
url str
start int
end int

Fields

field type descriptor
text str
citations list[Cit]
def build_url_to_id(docs: list[Doc]) -> dict !{}

Parameters

name type
docs list[Doc]

Returns dict

Effects !{}

def by_start(cits: list[Cit]) -> list[Cit] !{}

Parameters

name type
cits list[Cit]

Returns list[Cit]

Effects !{}

def rewrite(text: str, cits: list[Cit], ids: dict) -> str !{}

Parameters

name type
text str
cits list[Cit]
ids dict

Returns str

Effects !{}

def dense_renumber(used_ids: list[int]) -> dict !{}

Parameters

name type
used_ids list[int]

Returns dict

Effects !{}