Sfoglia il codice sorgente

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

lishimin 3 anni fa
parent
commit
4d865cf499
1 ha cambiato i file con 7 aggiunte e 0 eliminazioni
  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)