package.yaml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. # -*- coding: utf-8 -*-
  2. # 规则文件:标段/包编号提取
  3. # 源:assembly/package_scope.py 第 74-94 行
  4. # 迁移日期:2026-08-17 Phase 7 §7.6 中优先级
  5. # 说明:原 package_number_pattern 已被注释掉(太复杂,实际使用的是
  6. # other_package_pattern / win_tenderer_pattern / model_pattern /
  7. # package_code_pattern / number_pattern / re_digital 6 个正则)。
  8. # 本文件迁移实际使用的 6 个模式。
  9. version: 1
  10. category: PACKAGE
  11. description: |
  12. 标段/包编号与名称提取正则。原 package_scope.py 第 86-94 行定义的
  13. 6 个 re.compile 模式,用于从文本中提取:
  14. - 项目/物资/设备名称(other_package_pattern)
  15. - 中标候选人/供应商名称(win_tenderer_pattern)
  16. - 型号/序号(model_pattern)
  17. - 编号提取(package_code_pattern)
  18. - 纯数字判断(re_digital)
  19. - 通用编号片段(number_pattern)
  20. patterns:
  21. - id: other_package_name
  22. description: |
  23. 项目/物资/设备/场次/标段/标的/产品 名称提取。
  24. 匹配 "项目名称:xxx," 格式,名称部分 2-50 字符。
  25. 原 other_package_pattern。
  26. pattern: '((项目|物资|设备|场次|标段|标的|产品)(名称)?)[::]([^,。]{2,50}?)[,。]'
  27. method: search
  28. golden_examples:
  29. - input: "项目名称:人工智能应用项目建设,"
  30. should_match: true
  31. - input: "设备名称:服务器,"
  32. should_match: true
  33. - input: "标段名称:一标段,"
  34. should_match: true
  35. - input: "无名称文本"
  36. should_match: false
  37. - id: win_tenderer_name
  38. description: |
  39. 中标候选人/供应商 名称提取。
  40. 匹配 "中标候选人名称:xxx," 格式,名称部分 2-25 字符。
  41. 原 win_tenderer_pattern。
  42. pattern: '(中标候?选?人|供应商)(名称)?[::](.{2,25})[,。]'
  43. method: search
  44. golden_examples:
  45. - input: "中标候选人名称:上海得宸科技有限公司,"
  46. should_match: true
  47. - input: "供应商:用友金融信息技术股份有限公司,"
  48. should_match: true
  49. - input: "中标人:张三,"
  50. should_match: true
  51. - input: "项目名称:xxx,"
  52. should_match: false
  53. - id: model_number
  54. description: |
  55. 型号/序号 提取。
  56. 匹配 "型号:xxx," 或 "序号:xxx," 格式,值部分 2-20 字符。
  57. 原 model_pattern。
  58. pattern: '(型号|序号)[::]([^,。]{2,20})[,。]'
  59. method: search
  60. golden_examples:
  61. - input: "型号:ABC-100,"
  62. should_match: true
  63. - input: "序号:001,"
  64. should_match: true
  65. - input: "项目名称:xxx,"
  66. should_match: false
  67. - id: package_code
  68. description: |
  69. 编号提取。匹配 "编号:xxx" 格式,值部分为 1-20 位字母/数字/连字符/括号。
  70. 原 package_code_pattern。
  71. pattern: '(?:编号[::]?\s*)([-\dA-Za-z\(\)]{1,20})'
  72. method: search
  73. golden_examples:
  74. - input: "编号:DX2024-001"
  75. should_match: true
  76. - input: "编号:001"
  77. should_match: true
  78. - input: "无编号文本"
  79. should_match: false
  80. - id: number_fragment
  81. description: |
  82. 通用编号片段提取。匹配 1-4 位的字母/数字/中文数字/罗马数字片段。
  83. 用于标段编号中的子片段提取(如"一标段"中的"一")。
  84. 原 number_pattern。
  85. pattern: '[0-9A-Za-z一二三四五六七八九十ⅠⅡⅢⅣⅤⅥⅦ]{1,4}'
  86. method: search
  87. golden_examples:
  88. - input: "一"
  89. should_match: true
  90. - input: "ABC"
  91. should_match: true
  92. - input: "1234"
  93. should_match: true
  94. - input: "ABCDE"
  95. should_match: true
  96. - input: ""
  97. should_match: false
  98. - id: is_digital
  99. description: |
  100. 纯数字判断(fullmatch)。用于标段编号归一化,
  101. 判断编号是否为纯数字(如"01"→"1")。
  102. 原 re_digital。
  103. pattern: '^\d+$'
  104. method: fullmatch
  105. golden_examples:
  106. - input: "123"
  107. should_match: true
  108. - input: "01"
  109. should_match: true
  110. - input: "1"
  111. should_match: true
  112. - input: "A1"
  113. should_match: false
  114. - input: "一"
  115. should_match: false