elm.ords.validation.location.CountyValidator
- class CountyValidator(structured_llm_caller, score_thresh=0.8)[source]
Bases:
object
ELM Ords County validator.
Combines the logic of several validators into a single class.
- Purpose:
Determine wether a document pertains to a specific county.
- Responsibilities:
Use a combination of heuristics and LLM queries to determine wether or not a document pertains to a particular county.
- Key Relationships:
Uses a
StructuredLLMCaller
for LLM queries and delegates sub-validation toCountyNameValidator
,CountyJurisdictionValidator
, andURLValidator
.
- Parameters:
structured_llm_caller (
elm.ords.llm.StructuredLLMCaller
) – StructuredLLMCaller instance. Used for structured validation queries.score_thresh (float, optional) – Score threshold to exceed when voting on content from raw pages. By default,
0.8
.
Methods
check
(doc, county, state)Check if the document belongs to the county.
- async check(doc, county, state)[source]
Check if the document belongs to the county.
- Parameters:
doc (
elm.web.document.BaseDocument
) – Document instance. Should contain a “source” key in the metadata that contains a URL (used for the URL validation check). Raw content will be parsed for county name and correct jurisdiction.county (str) – County that document should belong to.
state (str) – State corresponding to county input.
- Returns:
bool – True if the doc contents pertain to the input county. False otherwise.