compass.utilities.finalize.trim_ordinance_text#
- trim_ordinance_text(db)[source]#
Trim the
ordinance_textcolumn to a maximum character countLLMs occasionally return a very long excerpt for
ordinance_text, which makes the output CSV unwieldy. Any excerpt longer thanMAX_ORDINANCE_TEXT_CHARSis cut back to the last whole word that fits and marked with a trailing ellipsis, matching the ellipsis convention already used for elided text within an excerpt.- Parameters:
db (
pandas.DataFrame) – The database containing extraction results, which may include an"ordinance_text"column.- Returns:
pandas.DataFrame– The updated database, with any over-longordinance_textentries trimmed. Databases without that column are returned unchanged.