瀏覽代碼

服务时间规则优化

znj 1 年之前
父節點
當前提交
98b018550a
共有 2 個文件被更改,包括 14 次插入5 次删除
  1. 6 2
      BiddingKG/dl/interface/getAttributes.py
  2. 8 3
      BiddingKG/dl/time/re_servicetime.py

+ 6 - 2
BiddingKG/dl/interface/getAttributes.py

@@ -3867,7 +3867,7 @@ def extract_serviceTime(service_time,page_time):
             if get_days_between(page_time,time_list[1])>1 and get_days_between(time_list[0],time_list[1])>0:
                 serviceTime_dict['service_end'] = time_list[1]
                 serviceTime_dict['service_start'] = time_list[0]
-        else:
+        elif len(time_list)==1:
             if get_days_between(page_time, time_list[0]) > 1:
                 serviceTime_dict['service_end'] = time_list[0]
             # service_days = (time.mktime(time.strptime(end_time,"%Y-%m-%d"))-page_timestamp)/(24*60*60)
@@ -3893,7 +3893,7 @@ def extract_serviceTime(service_time,page_time):
             if get_days_between(page_time, time_list[1]) > 1 and get_days_between(time_list[0], time_list[1]) > 0:
                 serviceTime_dict['service_end'] = time_list[1]
                 serviceTime_dict['service_start'] = time_list[0]
-        else:
+        elif len(time_list)==1:
             if get_days_between(page_time, time_list[0]) > 1:
                 serviceTime_dict['service_end'] = time_list[0]
                 # service_days = (time.mktime(time.strptime(end_time,"%Y-%m-%d"))-page_timestamp)/(24*60*60)
@@ -3945,6 +3945,10 @@ def extract_serviceTime(service_time,page_time):
 
     return serviceTime_dict
 
+def getServiceTime():
+
+    pass
+
 def getOtherAttributes(list_entity,page_time,prem,channel_dic):
     dict_other = {"moneysource":"",
                   "person_review":[],

+ 8 - 3
BiddingKG/dl/time/re_servicetime.py

@@ -31,7 +31,7 @@ before = '(?P<before>' \
          '|合同起始日起|合同的?履约期|履约截止日期|承包期限|合同的?完成日期|特许经营期限' \
          '|服务期间|服务履行期|委托(管理)?期限|经营期限|数量' \
          '|(工期|服务期限?|交货期限?|服务履行期|合同期限?|履[行约]期限?)说明|存款期限?|(存款|存放|定存)(期|年)限|服务日期' \
-         '|服务(有效期|年限)|本?合同有效期|协议有效期' \
+         '|服务(有效期|年限)|本?合同有效期|协议有效期|项目期限' \
          ')'
 
 
@@ -393,10 +393,15 @@ def re_find_all_result(reg, input, unit="", index=0):
             and (re.search('[日月]',input[i.start()+front_len: i.end()]) or not re.search('年',input[i.start()+front_len: i.end()])):
             continue
         # 排除某些容易错误的表达
-        if re.search("^(自合同签订[之次]日起至|合同签订[之次]日起|自合同签订[之次]日起|签订合同后' \
+        if re.search('^(自合同签订[之次]日起至|合同签订[之次]日起|自合同签订[之次]日起|签订合同后' \
               '|合同签订[之次]日起至|自合同签订[之次]日|合同签定后|自签订合同[之次]日起|自合同签订起' \
               '|[自从]?合同签[订定]生效[之次]日起|自合同签订后不超过|合同签订日至' \
-              '|合同签订生效[之次]日起|签订合同起)",input[i.start():i.start() + front_len]):
+              '|合同签订生效[之次]日起|签订合同起' \
+              '|[自从于]?签[订定署字](合同|协议书|协议)并?(期|开始履行|生效|有效期|约定|验收合格|期限|开始服务){0,2}(之[日后]|日期?[后起]|后|起|算|为)+[^。\d半一二三四五六七八九十壹两叁贰肆伍陆柒捌玖拾]{0,4}' \
+              '|[自从于]?(采购)?(合同|协议书|协议)(正式)?签[订定署字](完[成毕])?并?(期|开始履行|生效|验收合格|开始服务|期限|有效期|约定){0,2}(之[日后]|日期?[后起]|后|起|算|为)+[^。\d半一二三四五六七八九十壹两叁贰肆伍陆柒捌玖拾]{0,5}' \
+              '|(合同|协议书)签[订定署字]生效(之[日后]|后|起)[^。\d半一二三四五六七八九十壹两叁贰肆伍陆柒捌玖拾]{1,4}' \
+              '|[自从于]服务(合同|协议书|协议)生效(之[日后]|后|起)[^。\d半一二三四五六七八九十壹两叁贰肆伍陆柒捌玖拾]{1,4}' \
+              ')',input[i.start():i.start() + front_len]):
             continue
 
         text_index.append([i.start()+front_len, i.end()])