# -*- coding: utf-8 -*- # 规则文件:标段/包编号提取 # 源:assembly/package_scope.py 第 74-94 行 # 迁移日期:2026-08-17 Phase 7 §7.6 中优先级 # 说明:原 package_number_pattern 已被注释掉(太复杂,实际使用的是 # other_package_pattern / win_tenderer_pattern / model_pattern / # package_code_pattern / number_pattern / re_digital 6 个正则)。 # 本文件迁移实际使用的 6 个模式。 version: 1 category: PACKAGE description: | 标段/包编号与名称提取正则。原 package_scope.py 第 86-94 行定义的 6 个 re.compile 模式,用于从文本中提取: - 项目/物资/设备名称(other_package_pattern) - 中标候选人/供应商名称(win_tenderer_pattern) - 型号/序号(model_pattern) - 编号提取(package_code_pattern) - 纯数字判断(re_digital) - 通用编号片段(number_pattern) patterns: - id: other_package_name description: | 项目/物资/设备/场次/标段/标的/产品 名称提取。 匹配 "项目名称:xxx," 格式,名称部分 2-50 字符。 原 other_package_pattern。 pattern: '((项目|物资|设备|场次|标段|标的|产品)(名称)?)[::]([^,。]{2,50}?)[,。]' method: search golden_examples: - input: "项目名称:人工智能应用项目建设," should_match: true - input: "设备名称:服务器," should_match: true - input: "标段名称:一标段," should_match: true - input: "无名称文本" should_match: false - id: win_tenderer_name description: | 中标候选人/供应商 名称提取。 匹配 "中标候选人名称:xxx," 格式,名称部分 2-25 字符。 原 win_tenderer_pattern。 pattern: '(中标候?选?人|供应商)(名称)?[::](.{2,25})[,。]' method: search golden_examples: - input: "中标候选人名称:上海得宸科技有限公司," should_match: true - input: "供应商:用友金融信息技术股份有限公司," should_match: true - input: "中标人:张三," should_match: true - input: "项目名称:xxx," should_match: false - id: model_number description: | 型号/序号 提取。 匹配 "型号:xxx," 或 "序号:xxx," 格式,值部分 2-20 字符。 原 model_pattern。 pattern: '(型号|序号)[::]([^,。]{2,20})[,。]' method: search golden_examples: - input: "型号:ABC-100," should_match: true - input: "序号:001," should_match: true - input: "项目名称:xxx," should_match: false - id: package_code description: | 编号提取。匹配 "编号:xxx" 格式,值部分为 1-20 位字母/数字/连字符/括号。 原 package_code_pattern。 pattern: '(?:编号[::]?\s*)([-\dA-Za-z\(\)]{1,20})' method: search golden_examples: - input: "编号:DX2024-001" should_match: true - input: "编号:001" should_match: true - input: "无编号文本" should_match: false - id: number_fragment description: | 通用编号片段提取。匹配 1-4 位的字母/数字/中文数字/罗马数字片段。 用于标段编号中的子片段提取(如"一标段"中的"一")。 原 number_pattern。 pattern: '[0-9A-Za-z一二三四五六七八九十ⅠⅡⅢⅣⅤⅥⅦ]{1,4}' method: search golden_examples: - input: "一" should_match: true - input: "ABC" should_match: true - input: "1234" should_match: true - input: "ABCDE" should_match: true - input: "" should_match: false - id: is_digital description: | 纯数字判断(fullmatch)。用于标段编号归一化, 判断编号是否为纯数字(如"01"→"1")。 原 re_digital。 pattern: '^\d+$' method: fullmatch golden_examples: - input: "123" should_match: true - input: "01" should_match: true - input: "1" should_match: true - input: "A1" should_match: false - input: "一" should_match: false