From d607b55c243850b106653120b7c5b7bf82d80fd2 Mon Sep 17 00:00:00 2001 From: OSHA-B Date: Mon, 6 Jul 2026 07:02:58 +0200 Subject: [PATCH] fix(nlp): prevent dotted-number cross-references from being classified as headings in Laws chunker (#16626) --- rag/nlp/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rag/nlp/__init__.py b/rag/nlp/__init__.py index 26a65a4df3..eb18d3e5c1 100644 --- a/rag/nlp/__init__.py +++ b/rag/nlp/__init__.py @@ -296,7 +296,7 @@ def random_choices(arr, k): def not_bullet(line): - patt = [r"0", r"[0-9]+ +[0-9~个只-]", r"[0-9]+\.{2,}"] + patt = [r"0", r"[0-9]+ +[0-9~个只-]", r"[0-9]+\.{2,}", r"[0-9]+(\.[0-9]+){2,}[的中]"] return any([re.match(r, line) for r in patt]) @@ -1029,7 +1029,7 @@ def tree_merge(bull, sections, depth): text = re.sub(r"\u3000", " ", text).strip() for i, title in enumerate(BULLET_PATTERN[bull]): - if re.match(title, text.strip()): + if re.match(title, text.strip()) and not not_bullet(text): return i + 1, text else: if re.search(r"(title|head)", layout) and not not_title(text):