compass.extraction.apply.extract_ordinance_values#

async extract_ordinance_values(doc, parser, text_key, out_key)[source]#

Extract ordinance values for a single document

Document must be known to contain ordinance text.

Parameters:
  • doc (elm.web.document.BaseDocument) – A document known to contain ordinance text. This means it must contain an text_key key in the attrs. You can run extract_ordinance_text_with_llm() to have this attribute populated automatically for documents that are found to contain ordinance data. Note that if the document’s attrs does not contain the text_key key, it will not be processed.

  • parser (object) – Parser instance with an async parse method that converts cleaned ordinance text into structured values.

  • text_key (str) – Name of the key under which cleaned text is stored in doc.attrs. This text should be ready for extraction.

  • out_key (str) – Name of the key under which extracted ordinances should be stored.

Returns:

elm.web.document.BaseDocument – Document that has been parsed for ordinance values. The results of the extraction are stored in the document’s attrs.

Notes

When the cleaned text is missing or empty the function emits a compass.warn.COMPASSWarning and leaves doc unchanged.