aeat.application.corpus_search._citation_lookup module¶
Structured exact-citation lookup over the registry legal catalogue.
Exact citations (“art. 27.2 LGT”, ley-58-2003:art-27.2) do not go
through the FTS index: the wheel already ships typed citation data (the
registry legal_refs with their corpus_ref and BOE permalinks),
so this is a direct structured key lookup, not a parallel citation
parser. The registry legal catalogue is the single citation authority
(aeat-registry-authority-flow); this module reuses it and adds
the one thing the product lacked at runtime: resolving a citation id to
the verbatim authoritative text its corpus_ref points at.
The verbatim text is read from the bundled *.extracted.json sidecar
(the clean, structured extraction the corpus ships) rather than the raw
HTML, and sliced to the unit the citation’s anchor names when the source
file carries multiple units.
See also
CitationResolutionTyped result carrying catalogue metadata and verbatim text.
search_corpus()Exact citation ids short-circuit through this lookup before ranking.
_read_corpus_resource()aeat://corpusresource reader that accepts citation ids and retrievalcorpus_refvalues.
- class CitationLookup(legal, *, source_root)[source]¶
Bases:
objectResolve a registry citation id to metadata plus verbatim text.
The lookup is built over the reviewed legal catalogue and the corpus source root (the bundled
_datatree the catalogue’scorpus_refvalues are relative to).- Parameters:
legal (Mapping[str, LegalReference])
source_root (Path)
- resolve(citation_id)[source]¶
Resolve
citation_idto aCitationResolution.- Parameters:
citation_id (
str) – A registrylegal_refsid, e.g.ley-58-2003:art-27.2.- Return type:
- Returns:
The citation’s catalogue metadata plus the verbatim authoritative text its
corpus_refpoints at.- Raises:
CorpusSearchInputError – If the id is unknown to the catalogue or its backing corpus text cannot be read.
- resolve_corpus_text(ref)[source]¶
Resolve a citation id OR a corpus_ref (
path#anchor) to verbatim text.The
aeat://corpus/{ref}resource accepts either form: a retrieval hit’scorpus_refor a bare citation id. A known citation id routes throughresolve(); otherwiserefis read as a corpus path and anchor.- Raises:
CorpusSearchInputError – If
refresolves to no readable text or escapes the corpus root.- Return type:
- Parameters:
ref (str)
- bundled_citation_lookup()[source]¶
Return a
CitationLookupover the bundled registry catalogue.- Return type: