浏览代码

修复项目需求预算要素提取中时间文章没年份及pagetime为空的bug

lishimin 3 年之前
父节点
当前提交
4d865cf499
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      BiddingKG/dl/interface/predictor.py

+ 7 - 0
BiddingKG/dl/interface/predictor.py

@@ -1696,6 +1696,13 @@ class ProductAttributesPredictor():
                         num = '0' + num
                     order_begin = "%s-%s-01" % (y, m)
                     order_end = "%s-%s-%s" % (y, m, num)
+            else:
+                y = str(datetime.datetime.now().year)
+                num = self.get_monthlen(y, m)
+                if len(num) < 2:
+                    num = '0' + num
+                order_begin = "%s-%s-01" % (y, m)
+                order_end = "%s-%s-%s" % (y, m, num)
             return order_begin, order_end
 
         t1 = re.search('^(\d{4})(年|/|.|-)(\d{1,2})月?$', text)