elm.ords.extraction.apply.check_for_ordinance_info
- async check_for_ordinance_info(doc, text_splitter, **kwargs)[source]
Parse a single document for ordinance information.
- Parameters:
doc (elm.web.document.BaseDocument) – A document potentially containing ordinance information. Note that if the document’s metadata contains the
"contains_ord_info"
key, it will not be processed. To force a document to be processed by this function, remove that key from the documents metadata.text_splitter (obj) – Instance of an object that implements a split_text method. The method should take text as input (str) and return a list of text chunks. Langchain’s text splitters should work for this input.
**kwargs – Keyword-value pairs used to initialize an elm.ords.llm.LLMCaller instance.
- Returns:
elm.web.document.BaseDocument – Document that has been parsed for ordinance text. The results of the parsing are stored in the documents metadata. In particular, the metadata will contain a
"contains_ord_info"
key that will be set toTrue
if ordinance info was found in the text, andFalse
otherwise. IfTrue
, the metadata will also contain a"date"
key containing the most recent date that the ordinance was enacted (or a tuple of None if not found), and an"ordinance_text"
key containing the ordinance text snippet. Note that the snippet may contain other info as well, but should encapsulate all of the ordinance text.