diff --git a/test_accuracy_batch_full.py b/test_accuracy_batch_full.py index 743ecf6..080ef30 100644 --- a/test_accuracy_batch_full.py +++ b/test_accuracy_batch_full.py @@ -1511,7 +1511,7 @@ def extract_institution_from_crt(pdf_path: str) -> List[str]: def clean_institution_name(text: str) -> str: """ - 清理机构名称,移除末尾的数字、CMA码等干扰内容 + 清理机构名称,移除末尾的数字、CMA码、印章名称等干扰内容 Args: text: 原始机构名称 @@ -1522,6 +1522,19 @@ def clean_institution_name(text: str) -> str: if not text: return text + # 移除常见的印章名称(不需要在末尾,可以移除任何位置的) + # 这处理"机构名称检验检测专用章"或"机构名称检验检测专用章123456" + seal_patterns = [ + r'检验检测专用章', + r'检测专用章', + r'检验专用章', + r'鉴定专用章', + r'公章', + r'专用章', + ] + for pattern in seal_patterns: + text = text.replace(pattern, '') + # 移除末尾的数字序列(如CMA码) text = re.sub(r'\d{6,}$', '', text) # 6位及以上数字 text = re.sub(r'\d{11,}$', '', text) # 11位及以上数字(CMA码)