time_context.yaml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. # -*- coding: utf-8 -*-
  2. # 规则文件:时间实体上下文关键词
  3. # 源:assembly/time_attrs.py 第 370-574 行 getTimeAttributes() 内 re.search 调用
  4. # 迁移日期:2026-08-17 Phase 7 §7.6 高优先级
  5. # 说明:这些正则用于判断时间实体附近的上下文语义,将时间分配到
  6. # time_bidclose / time_bidopen / time_signContract 等字段。
  7. # 调用方使用 RuleLoader.get_pattern(id).search(entity_left3) 替换原 re.search。
  8. version: 1
  9. category: TIME
  10. description: |
  11. 时间实体上下文分类正则。原 getTimeAttributes() 函数中用 re.search(pattern, context)
  12. 判断时间实体的上下文语义(截标/开标/报名/合同等),本文件将散落在函数体中的
  13. 正则提取为命名规则,使时间字段分配逻辑可由 dl/rules/ 配置驱动。
  14. patterns:
  15. # ── 截标/投标截止(最高频,多处复用) ──
  16. - id: ctx_bidclose
  17. description: |
  18. 截标/投标截止/文件提交截止/报价截止/响应截止/文件提交接收 等上下文。
  19. 原 time_attrs.py 多处以同一 pattern 出现(370/378/381/386/389 行)。
  20. pattern: '截标|投标.{,2}截止|([递提]交|接收)(?:文件)?.{,2}截止|报价.{,2}截止|响应.{,2}截止|文件.{,2}([递提]交|接收)'
  21. method: search
  22. golden_examples:
  23. - input: "投标截止时间"
  24. should_match: true
  25. - input: "递交文件截止"
  26. should_match: true
  27. - input: "报价截止日期"
  28. should_match: true
  29. - input: "开标时间"
  30. should_match: false
  31. # ── 开标/评审时间 ──
  32. - id: ctx_bidopen
  33. description: 开标/评审比选开始时间/选取时间 上下文
  34. pattern: '开标|(评审|比选).{,2}(?:开始)?(时间|日期)|选取.{,2}(时间|日期)'
  35. method: search
  36. golden_examples:
  37. - input: "开标时间"
  38. should_match: true
  39. - input: "评审开始时间"
  40. should_match: true
  41. - input: "选取日期"
  42. should_match: true
  43. - input: "投标截止"
  44. should_match: false
  45. # ── 报名 ──
  46. - id: ctx_registration
  47. description: 报名上下文(报名时间判定)
  48. pattern: '报名'
  49. method: search
  50. golden_examples:
  51. - input: "报名时间"
  52. should_match: true
  53. - input: "报名截止"
  54. should_match: true
  55. - input: "开标时间"
  56. should_match: false
  57. # ── 获取文件 ──
  58. - id: ctx_getfile
  59. description: 获取文件上下文(取文件截止时间判定)
  60. pattern: '获取'
  61. method: search
  62. golden_examples:
  63. - input: "获取文件时间"
  64. should_match: true
  65. - input: "获取招标文件"
  66. should_match: true
  67. - input: "开标时间"
  68. should_match: false
  69. # ── 保证金 ──
  70. - id: ctx_earnest_money
  71. description: 保证金接受/收取 上下文
  72. pattern: '保证金.{,2}(接受|收取)|(接受|收取).{,2}保证金'
  73. method: search
  74. golden_examples:
  75. - input: "保证金接受时间"
  76. should_match: true
  77. - input: "收取保证金截止"
  78. should_match: true
  79. - input: "投标保证金"
  80. should_match: false
  81. # ── 挂牌开始 ──
  82. - id: ctx_listing_start
  83. description: 挂牌开始/起始时间日期 上下文
  84. pattern: '挂牌.?(开始|起始).?(?:时间|日期)'
  85. method: search
  86. golden_examples:
  87. - input: "挂牌开始时间"
  88. should_match: true
  89. - input: "挂牌起始日期"
  90. should_match: true
  91. - input: "挂牌截止时间"
  92. should_match: false
  93. # ── 挂牌截止 ──
  94. - id: ctx_listing_end
  95. description: 挂牌截止/结束时间日期 上下文
  96. pattern: '挂牌.?(截[止至]|结束).?(?:时间|日期)'
  97. method: search
  98. golden_examples:
  99. - input: "挂牌截止时间"
  100. should_match: true
  101. - input: "挂牌结束日期"
  102. should_match: true
  103. - input: "挂牌开始时间"
  104. should_match: false
  105. # ── 挂牌通用(需配合上下文判断 start/end) ──
  106. - id: ctx_listing_any
  107. description: 挂牌时间/日期 通用上下文(需配合前后文判断 start/end)
  108. pattern: '挂牌.{,4}(?:时间|日期)'
  109. method: search
  110. golden_examples:
  111. - input: "挂牌时间"
  112. should_match: true
  113. - input: "挂牌日期"
  114. should_match: true
  115. - input: "开标时间"
  116. should_match: false
  117. # ── 合同签订 ──
  118. - id: ctx_sign_contract
  119. description: |
  120. 合同签订时间/日期 上下文。匹配:
  121. - 合同xx签订xx(时间|日期)
  122. - 签订xx合同xx(时间|日期)
  123. - 合同签订(行尾)
  124. pattern: '(合同.{,2}签[订定署].{,2}|签[订定署].{,2}合同.{,2})(?:时间|日期)|合同签[订定署].{,1}$'
  125. method: search
  126. golden_examples:
  127. - input: "合同签订时间"
  128. should_match: true
  129. - input: "签订合同日期"
  130. should_match: true
  131. - input: "合同签订"
  132. should_match: true
  133. - input: "服务期限"
  134. should_match: false
  135. # ── 合同/服务起始 ──
  136. - id: ctx_contract_start
  137. description: 合同/服务/履约 起始/开始时间 上下文
  138. pattern: '(合同|服务|履约|(合同|服务)履行).{,4}(?:起始|开始)(?:时间|日期)'
  139. method: search
  140. golden_examples:
  141. - input: "合同起始时间"
  142. should_match: true
  143. - input: "服务开始日期"
  144. should_match: true
  145. - input: "履约履行开始时间"
  146. should_match: true
  147. - input: "合同截止时间"
  148. should_match: false
  149. # ── 合同/服务截止 ──
  150. - id: ctx_contract_end
  151. description: 合同/服务/履约 完成/截止/结束 时间 上下文
  152. pattern: '(合同|服务|履约).{,2}(?:完成|截止|结束)(?:时间|日期|时限)'
  153. method: search
  154. golden_examples:
  155. - input: "合同截止时间"
  156. should_match: true
  157. - input: "服务完成日期"
  158. should_match: true
  159. - input: "履约结束时限"
  160. should_match: true
  161. - input: "合同起始时间"
  162. should_match: false
  163. # ── 合同/服务期限通用 ──
  164. - id: ctx_contract_period
  165. description: |
  166. 合同/服务/履约 期限/有效期/时间/日期/周期 通用上下文。
  167. 用于判断时间实体是否属于合同服务期。
  168. pattern: '(?:合同|服务|履约|(合同|服务)履行)(?:期限?|有效期)|(?:服务|履约|(合同|服务)履行)(?:时间|日期|周期)|(?:服务|合同)[时年]限|合同周期'
  169. method: search
  170. golden_examples:
  171. - input: "合同期限"
  172. should_match: true
  173. - input: "服务有效期"
  174. should_match: true
  175. - input: "履约时间"
  176. should_match: true
  177. - input: "合同年限"
  178. should_match: true
  179. - input: "开标时间"
  180. should_match: false
  181. # ── 截止/止 标记(配合 ctx_contract_period 使用) ──
  182. - id: ctx_end_marker
  183. description: 截止/止/前 等结束标记(用于判断 period 是 start 还是 end)
  184. pattern: '到|至|截[至止]'
  185. method: search
  186. golden_examples:
  187. - input: "至"
  188. should_match: true
  189. - input: "截止"
  190. should_match: true
  191. - input: "开始"
  192. should_match: false
  193. # ── 报价/竞价开始 ──
  194. - id: ctx_bidprice_start
  195. description: 报价/竞价 开始/起始 时间日期 上下文
  196. pattern: '[报竞]价.{,2}(开始|起始).{,2}(时间|日期)'
  197. method: search
  198. golden_examples:
  199. - input: "报价开始时间"
  200. should_match: true
  201. - input: "竞价起始日期"
  202. should_match: true
  203. - input: "报价截止时间"
  204. should_match: false
  205. # ── 报价/竞价起止 ──
  206. - id: ctx_bidprice_range
  207. description: 报价/竞价 起止 时间日期 上下文
  208. pattern: '[报竞]价.{,2}起止.{,2}(时间|日期)'
  209. method: search
  210. golden_examples:
  211. - input: "报价起止时间"
  212. should_match: true
  213. - input: "竞价起止日期"
  214. should_match: true
  215. - input: "报价开始时间"
  216. should_match: false
  217. # ── 报价/竞价截止 ──
  218. - id: ctx_bidprice_close
  219. description: 报价/竞价 截止 时间日期 上下文
  220. pattern: '[报竞]价.{,2}截[止至].{,2}(时间|日期)'
  221. method: search
  222. golden_examples:
  223. - input: "报价截止时间"
  224. should_match: true
  225. - input: "竞价截至日期"
  226. should_match: true
  227. - input: "报价开始时间"
  228. should_match: false
  229. # ── 报价/竞价通用 ──
  230. - id: ctx_bidprice_any
  231. description: 报价/竞价 时间日期 通用上下文
  232. pattern: '(竞价|报价).?(时间|日期)'
  233. method: search
  234. golden_examples:
  235. - input: "报价时间"
  236. should_match: true
  237. - input: "竞价日期"
  238. should_match: true
  239. - input: "开标时间"
  240. should_match: false
  241. # ── 响应文件提交/接收(截止版) ──
  242. - id: ctx_response_close
  243. description: 响应文件提交/接收 截止 时间日期 上下文
  244. pattern: '响应.{,2}文件([递提]交|接收).{,2}(时间|日期)[::]|([递提]交|接收).{,2}响应.{,2}文件.{,2}(时间|日期)[::]'
  245. method: search
  246. golden_examples:
  247. - input: "响应文件递交时间:"
  248. should_match: true
  249. - input: "接收响应文件时间:"
  250. should_match: true
  251. - input: "响应文件递交时间"
  252. should_match: false
  253. # ── 响应文件提交/接收(非截止版) ──
  254. - id: ctx_response_any
  255. description: |
  256. 响应文件提交/接收 时间日期 通用上下文(排除含"截止"的场景)。
  257. 调用方需额外检查 not RuleLoader.match("ctx_response_close", text)。
  258. pattern: '响应.{,2}文件([递提]交|接收).{,2}(时间|日期)|([递提]交|接收).{,2}响应.{,2}文件.{,2}(时间|日期)'
  259. method: search
  260. golden_examples:
  261. - input: "响应文件递交时间"
  262. should_match: true
  263. - input: "接收响应文件时间"
  264. should_match: true
  265. - input: "开标时间"
  266. should_match: false
  267. # ── 服务期限关键词(大集合) ──
  268. - id: ctx_service_period
  269. description: |
  270. 服务/工期/履约期限 关键词集合。原 time_attrs.py 第 539-548 行的 re_service 变量,
  271. 用于 label==0 的时间实体判定为合同起止时间。
  272. pattern: '合同期限|工期/交货期/服务期|工期\(交货期\)|合格工期|服务期限|工期|工期要求|项目周期|计划工期\(服务期限\)|服务时限|履行期限|服务周期|供货期限|合格工期|计划工期\(服务期\)|服务期|服务,期|交货\(完工\)(时间|日期)|交付\(服务、完工\)(时间|日期)|交货(时间|日期)|工期承诺|(服务|合同|施工|实施|工程|设计)的?(年限|期限|周期|期:)|服务期限为|计划工期|工期要求|服务期限|服务期|投标工期|设计工期|合格服务周期|总工期|服务(时间|日期)(范围)?|流转期限|维护期限|服务时限|交货期|完成(时间|日期)|服务期限|中标工期|项目周期|期限要求|供货期|合同履行日期|计划的?周期|履约期限|合同约定完成时限|合同完成日期|承诺完成日期|合同起始日起|合同履约期|履约截止日期|承包期限|合同完成日期|服务期间|服务履行期|委托(管理)?期限|履约期限、地点等简要信息'
  273. method: search
  274. golden_examples:
  275. - input: "服务期限"
  276. should_match: true
  277. - input: "工期要求"
  278. should_match: true
  279. - input: "履约期限、地点等简要信息"
  280. should_match: true
  281. - input: "交货期"
  282. should_match: true
  283. - input: "开标时间"
  284. should_match: false