MCPcopy Create free account
hub / github.com/917Dhj/DeepPaperNote / normalize_heading

Function normalize_heading

scripts/common.py:1605–1612  ·  view source on GitHub ↗
(line: str)

Source from the content-addressed store, hash-verified

1603
1604
1605def normalize_heading(line: str) -> str:
1606 line = normalize_pdf_text_artifacts(line or "").strip().lower()
1607 line = re.sub(r"^\s*(?:section\s*)?\d+(\.\d+)*[\s.、.::-]*", "", line)
1608 line = re.sub(r"^\s*[一二三四五六七八九十百千]+[、..:\s-]*", "", line)
1609 line = re.sub(r"^\s*[ivxlcdm]+[.)\s]+", "", line)
1610 line = re.sub(r"[^a-z0-9\u3400-\u9fff\s]", " ", line)
1611 line = re.sub(r"(?<=[\u3400-\u9fff])\s+(?=[\u3400-\u9fff])", "", line)
1612 return re.sub(r"\s+", " ", line).strip()
1613
1614
1615SECTION_ALIASES = {

Callers 3

section_idFunction · 0.90
match_section_headingFunction · 0.85
stop_section_reasonFunction · 0.85

Calls 1

Tested by

no test coverage detected