rank.yaml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. # -*- coding: utf-8 -*-
  2. # 规则文件:排名识别
  3. # 源:template_extract/template_extractor.py get_rank() 第 96-102 行
  4. # 迁移日期:2026-08-12 Phase 7
  5. version: 1
  6. category: RANK
  7. description: |
  8. 排名识别(第 1/2/3 名 → win_tenderer/second_tenderer/third_tenderer)。
  9. 原 template_extractor.get_rank() 函数,使用 re.match(头部匹配)。
  10. 迁移后 get_rank() 改为遍历 RuleLoader.get_pattern(id).match(text)。
  11. patterns:
  12. - id: rank_first
  13. description: 第 1 名/中标人 → win_tenderer
  14. pattern: '第?[1一](名|((中标|成交|中选)?(候选人|供应商))?)?$|首选供应商$'
  15. method: match
  16. golden_examples:
  17. - input: "第1名"
  18. should_match: true
  19. - input: "第一名"
  20. should_match: true
  21. - input: "1"
  22. should_match: true
  23. - input: "一"
  24. should_match: true
  25. - input: "1中标候选人"
  26. should_match: true
  27. - input: "首选供应商"
  28. should_match: true
  29. - input: "第2名"
  30. should_match: false
  31. - input: "中标候选人"
  32. should_match: false
  33. - input: "第一名候选人"
  34. should_match: false
  35. - id: rank_second
  36. description: 第 2 名 → second_tenderer
  37. pattern: '第?[2二](名|((中标|成交|中选)?(候选人|供应商))?)?$'
  38. method: match
  39. golden_examples:
  40. - input: "第2名"
  41. should_match: true
  42. - input: "第二名"
  43. should_match: true
  44. - input: "2"
  45. should_match: true
  46. - input: "第二中标候选人"
  47. should_match: true
  48. - input: "第1名"
  49. should_match: false
  50. - input: "第3名"
  51. should_match: false
  52. - id: rank_third
  53. description: 第 3 名 → third_tenderer
  54. pattern: '第?[3三](名|((中标|成交|中选)?(候选人|供应商))?)?$'
  55. method: match
  56. golden_examples:
  57. - input: "第3名"
  58. should_match: true
  59. - input: "第三名"
  60. should_match: true
  61. - input: "3"
  62. should_match: true
  63. - input: "第三中标候选人"
  64. should_match: true
  65. - input: "第1名"
  66. should_match: false
  67. - input: "第2名"
  68. should_match: false