MCPcopy Create free account
hub / github.com/RASAAS/docmcp-knowledge / _normalize_section_headings

Function _normalize_section_headings

scripts/clean_fda_fulltext.py:262–268  ·  view source on GitHub ↗

Convert roman numeral section headers to proper markdown headings.

(text: str)

Source from the content-addressed store, hash-verified

260
261
262def _normalize_section_headings(text: str) -> str:
263 """Convert roman numeral section headers to proper markdown headings."""
264 text = re.sub(r"\n([IVXLCDM]+)\.\s*\n\s*([A-Z][^\n]+)", r"\n## \1. \2", text)
265 text = re.sub(r"\n([A-Z])\.\s*\n\s*([A-Z][^\n]+)", r"\n### \1. \2", text)
266 text = re.sub(r"\n(\d+)\.\s*\n\s*([A-Z][^\n]+)", r"\n#### \1. \2", text)
267 text = re.sub(r"\n([IVXLCDM]+)\.\s+([A-Z][^\n]+)", r"\n## \1. \2", text)
268 return text
269
270
271def _collapse_blank_lines(text: str) -> str:

Callers 1

clean_fulltextFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected