fix: [contracts] Markdown ↔ DOCX 동기화 100% 달성

- 분할 문단 원복 (비밀유지서약서, 영업파트너 위촉계약서 2종)
- 제목 꺾쇠(< >) 복원 (영업파트너 위촉계약서 2종)
- 회사 이메일 누락 복원 (영업파트너 위촉계약서 2종)
- sync_check 정규화 개선 (Bold 마커, 리스트 접두사, 빈 테이블 행)
This commit is contained in:
김보곤
2026-02-22 17:52:57 +09:00
parent 3013406100
commit 52e3f8e375
4 changed files with 21 additions and 10 deletions

View File

@@ -70,7 +70,11 @@ def extract_text_from_docx(docx_path):
continue
for row in table.rows:
row_text = " | ".join(cell.text.strip() for cell in row.cells)
cells = [cell.text.strip() for cell in row.cells]
# 빈 셀만 있는 행 건너뛰기
if not any(cells):
continue
row_text = " | ".join(cells)
if row_text.strip():
lines.append(row_text)
@@ -142,6 +146,10 @@ def normalize_text(text):
text = text.replace("\u3000", " ") # ideographic space
# 언더스코어 빈칸 정규화
text = re.sub(r"_{3,}", "___", text)
# Bold 마크업(**) 제거 (DOCX 텍스트에 리터럴 ** 포함되는 경우)
text = re.sub(r"\*\*(.+?)\*\*", r"\1", text)
# 선행 리스트 마커 제거 (DOCX 텍스트가 "- "로 시작하는 경우)
text = re.sub(r"^-\s+", "", text)
return text