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 eai-search’s
_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] |
build_url_to_id
Section titled “build_url_to_id”def build_url_to_id(docs: list[Doc]) -> dict !{}Parameters
| name | type |
|---|---|
docs | list[Doc] |
Returns dict
Effects !{}
by_start
Section titled “by_start”def by_start(cits: list[Cit]) -> list[Cit] !{}Parameters
| name | type |
|---|---|
cits | list[Cit] |
Returns list[Cit]
Effects !{}
rewrite
Section titled “rewrite”def rewrite(text: str, cits: list[Cit], ids: dict) -> str !{}Parameters
| name | type |
|---|---|
text | str |
cits | list[Cit] |
ids | dict |
Returns str
Effects !{}