std.provenance
Generated by
sema docfromstdlib/sema/provenance.sema. Import withfrom std.provenance import …. For a narrative introduction see std.provenance.
provenance
Section titled “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.
struct Cit
Section titled “struct Cit”Fields
| field | type | descriptor |
|---|---|---|
url |
str |
|
start |
int |
|
end |
int |
struct Doc
Section titled “struct Doc”Fields
| field | type | descriptor |
|---|---|---|
text |
str |
|
citations |
list[Cit] |
def build_url_to_id
Section titled “def build_url_to_id”def build_url_to_id(docs: list[Doc]) -> dict !{}Parameters
| name | type |
|---|---|
docs |
list[Doc] |
Returns dict
Effects !{}
def by_start
Section titled “def by_start”def by_start(cits: list[Cit]) -> list[Cit] !{}Parameters
| name | type |
|---|---|
cits |
list[Cit] |
Returns list[Cit]
Effects !{}
def rewrite
Section titled “def rewrite”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
Section titled “def dense_renumber”def dense_renumber(used_ids: list[int]) -> dict !{}Parameters
| name | type |
|---|---|
used_ids |
list[int] |
Returns dict
Effects !{}