compass.validation.location.JurisdictionValidator#
- class JurisdictionValidator(score_thresh=0.8, text_splitter=None, **kwargs)[source]#
Bases:
objectCoordinate URL and text jurisdiction validation for documents
Notes
The validator stores the score threshold, optional text splitter, and keyword arguments so they can be reused across many documents without reconfiguration.
- Parameters:
score_thresh (
float, optional) – Threshold applied to the weighted page vote. Documents at or above the threshold are considered jurisdiction matches. Default is0.8.text_splitter (
TextSplitter, optional) – Optional splitter attached to documents lacking atext_splitterattribute so validators can iterate page content consistently. Default isNone.**kwargs – Additional keyword arguments forwarded to
BaseLLMCallerand reused when instantiating subordinate validators.
Methods
check(doc, jurisdiction)Assess whether a document applies to the jurisdiction
- async check(doc, jurisdiction)[source]#
Assess whether a document applies to the jurisdiction
- Parameters:
doc (
elm.web.document.BaseDocument) – Document to evaluate. The validator expectsdoc.raw_pagesand, when available, adoc.attrs['source']URL for supplemental URL validation.jurisdiction (
compass.utilities.location.Jurisdiction) – Target jurisdiction descriptor capturing the required location attributes.
- Returns:
bool–Truewhen either the URL or document text validation confirms jurisdiction alignment,Falseotherwise.- Raises:
compass.exceptions.COMPASSError – Propagated if subordinate validators encounter LLM caller errors.
Notes
The method temporarily overrides
doc.text_splitterwhen a custom splitter is provided, ensuring the original splitter is restored after validation completes.Examples
>>> validator = JurisdictionValidator() >>> await validator.check(document, jurisdiction) True