zhangjinkun 2 hete
szülő
commit
9c27d94a75
2 módosított fájl, 23 hozzáadás és 9 törlés
  1. 16 5
      bidding/package.go
  2. 7 4
      bidding/util.go

+ 16 - 5
bidding/package.go

@@ -23,13 +23,15 @@ type MultiPackageClassifier struct {
 	coreKeywords    []string         // 核心关键词列表
 	packagePatterns []*regexp.Regexp // 标段编号正则模式
 	unKnowPack      []*regexp.Regexp // 不确认正则模式
-	excludePattern  *regexp.Regexp   // 排除条件正则模式
+	excludePattern  []*regexp.Regexp // 排除条件正则模式
 	budgetPattern   *regexp.Regexp   // 预算分项模式
 	awardPattern    *regexp.Regexp   // 中标公告模式
 
 	packNumCode             *regexp.Regexp // 编号值正则
 	titlePackageMorePattern *regexp.Regexp // 标题正则模式
 	titlePackageOnePattern  *regexp.Regexp // 标题正则模式
+	allPackKeys             *regexp.Regexp // 包含任意多包关键词
+
 }
 
 // 存储解析结果的结构体
@@ -76,9 +78,10 @@ func NewClassifier() *MultiPackageClassifier {
 		},
 
 		//4、 排除条件正则(整体招标相关表述)
-		excludePattern: regexp.MustCompile(
-			`采购包划分[::](1|一)个包|本项目不划分标段|本次招标划分为(1|一)个标段|本招标项目划分为标段(1|一)个标段|不可拆分|必须全部响应|统一评标|组合招标|打包采购`,
-		),
+		excludePattern: []*regexp.Regexp{
+			regexp.MustCompile(`采购包划分[::](1|一)个包|本项目不划分标段|本次招标划分为(1|一)个标段|本招标项目划分为标段(1|一)个标段|不可拆分|必须全部响应|统一评标|组合招标|打包采购`),
+			regexp.MustCompile(`本项目是否接受联合体.{0,5}否|本项目确定(1|一)家供应商中标`),
+		},
 		//5、 分包编号正则(提取分包编号数量)
 		packNumCode: regexp.MustCompile(packNumMatch),
 
@@ -97,6 +100,9 @@ func NewClassifier() *MultiPackageClassifier {
 
 		//9、 标题检查单包
 		titlePackageOnePattern: regexp.MustCompile(titlePackageOne),
+
+		//10、包含任意多包关键词
+		allPackKeys: regexp.MustCompile(`(包|标|段|分项)`),
 	}
 }
 
@@ -288,7 +294,12 @@ func (c *MultiPackageClassifier) checkBidderOptions(options string) bool {
 
 // hasExclusion 检查排除条件
 func (c *MultiPackageClassifier) hasExclusion(text string) bool {
-	return c.excludePattern.MatchString(text)
+	for _, pattern := range c.excludePattern {
+		if pattern.MatchString(text) {
+			return true
+		}
+	}
+	return false
 }
 
 // regMatchPackagePatterns 匹配结果

+ 7 - 4
bidding/util.go

@@ -109,7 +109,12 @@ func TableIsPackage(tables *AllTablesData) (bool, int, int) {
 					if val, err := strconv.Atoi(cellVal); err == nil {
 						numKey[fmt.Sprint(val)] = cellVal
 					} else {
-						if len(cellVal) > 0 {
+						if len(cellVal) > 0 && len([]rune(cellVal)) < 20 {
+							for _, item := range theadWordsList_Item {
+								if strings.EqualFold(item, cellVal) {
+									break
+								}
+							}
 							strKey[cellVal] = cellVal
 						}
 					}
@@ -126,9 +131,7 @@ func TableIsPackage(tables *AllTablesData) (bool, int, int) {
 				}
 			}
 		}
-		if tablesStrRows > 1 && tablesNumRows > 1 ||
-			tablesStrRows < 1 && tablesNumRows > 1 ||
-			tablesStrRows > 1 && tablesNumRows < 1 {
+		if tablesStrRows > 1 && tablesNumRows > 1 || tablesStrRows < 1 && tablesNumRows > 1 || tablesStrRows > 1 && tablesNumRows < 1 {
 			ispack = true
 		}
 	}