Browse Source

积分规则

zhangjinkun 6 năm trước cách đây
mục cha
commit
b11312745b
2 tập tin đã thay đổi với 166 bổ sung4 xóa
  1. 11 2
      src/main_test.go
  2. 155 2
      src/res/fieldscore.json

+ 11 - 2
src/main_test.go

@@ -13,9 +13,18 @@ import (
 func Test_task(t *testing.T) {
 	Mgo = MgoFactory(1, 3, 120, "192.168.3.207:27082", "extract_v3")
 	//extract.StartExtractTaskId("5b8f804025e29a290415aee1")
-	extract.StartExtractTestTask("5b8f804025e29a290415aee1", "5beb9ba2a5cb26b9b74e0a64", "1", "zjk_v3", "zjk_v3")
-	time.Sleep(3 * time.Second)
+	extract.StartExtractTestTask("5be107e600746bf92debf080", "5a999f3140d2d9bbe820dbb1", "1", "zjk_v3", "zjk_v3")
+	time.Sleep(5 * time.Second)
 }
+
+func Test_reghan(t *testing.T) {
+	context := `你好`
+	reg := regexp.MustCompile(`^[\p{Han}]+$`) //纯汉字
+	//reg := regexp.MustCompile(`[\\p{Han}]`)   //含汉字
+	tmp := reg.MatchString(context)
+	log.Println(tmp)
+}
+
 func Test_reg(t *testing.T) {
 	context := `sss<input  name="AgentCode" size="30" maxsize="50" value="91370800688271668P" class="textbox">
     dfdf<input type="hidden" name="AgentCode" size="30" maxsize="50" value="tttt" class="textbox"></input>`

+ 155 - 2
src/res/fieldscore.json

@@ -1,6 +1,6 @@
 {
     "extractype": {
-        "describe": "抽取类型打分",
+         "describe": "抽取类型打分",
         "title": 3,
         "table": 5,
         "colon": 3,
@@ -17,7 +17,7 @@
             },
             {
                 "describe": "以*结尾",
-                "regstr": "项目|工程|采购",
+                "regstr": "(项目|工程|采购)$",
                 "score": 3
             }
         ],
@@ -34,6 +34,159 @@
             }
         ]
     },
+    "buyer": {
+        "type": "string",
+        "position": [
+            {
+                "describe": "以*结尾",
+                "regstr": "(委员会|办公室|局|中心|协会|公司|政府|大学|学校|医院|集团|银行)$",
+                "score": 3
+            },
+            {
+                "describe": "以*结尾",
+                "regstr": "交易中心",
+                "score": -3
+            }
+        ],
+        "length": [
+            {
+                "describe": "长度打分min>val:0,min<=val<=max:1,max<val:-1",
+                "min": 4,
+                "max": 15,
+                "score": [
+                    0,
+                    1,
+                    -1
+                ]
+            }
+        ]
+    },
+    "winner": {
+        "type": "string",
+        "position": [
+            {
+                "describe": "以*结尾",
+                "regstr": "(公司|合作社)$",
+                "score": 3
+            }
+        ],
+        "length": [
+            {
+                "describe": "长度打分min>val:0,min<=val<=max:1,max<val:-1",
+                "min": 4,
+                "max": 15,
+                "score": [
+                    0,
+                    1,
+                    -1
+                ]
+            }
+        ]
+    },
+    "agency": {
+        "type": "string",
+        "position": [
+            {
+                "describe": "以*中部",
+                "regstr": "^.*(工程管理|招标代理|咨询|项目管理).*$",
+                "score": 1
+            },
+            {
+                "describe": "以*结尾",
+                "regstr": "(公司|事务所)$",
+                "score": 1
+            }
+        ],
+        "length": [
+            {
+                "describe": "长度打分min>val:0,min<=val<=max:1,max<val:-1",
+                "min": 4,
+                "max": 15,
+                "score": [
+                    0,
+                    1,
+                    -1
+                ]
+            }
+        ]
+    },
+    "buyerperson": {
+        "type": "string",
+        "position": [
+            {
+                "describe": "以*结尾",
+                "regstr": "(工|老师|经理|女士|先生|主任|科长)$",
+                "score": 1
+            }
+        ],
+        "length": [
+            {
+                "describe": "长度打分min>val:0,min<=val<=max:1,max<val:-1",
+                "min": 2,
+                "max": 6,
+                "score": [
+                    0,
+                    1,
+                    -1
+                ]
+            }
+        ]
+    },
+    "buyertel": {
+        "type": "string",
+        "position": [
+            {
+                "describe": "出现中文汉字",
+                "regstr": "[\\p{Han}]",
+                "score": -1
+            }
+        ],
+        "length": [
+            {
+                "describe": "长度打分min>val:-1,min<=val<=max:1,max<val:-1",
+                "min": 7,
+                "max": 14,
+                "score": [
+                    -1,
+                    1,
+                    -1
+                ]
+            }
+        ]
+    },
+    "projectcode": {
+        "type": "string",
+        "position": [
+            {
+                "describe": "全为中文汉字",
+                "regstr": "^[\\p{Han}]+$",
+                "score": -1
+            }
+        ],
+        "length": [
+            {
+                "describe": "长度打分min>val:-1,min<=val<=max:1,max<val:-1",
+                "min": 6,
+                "max": 25,
+                "score": [
+                    -1,
+                    1,
+                    -1
+                ]
+            }
+        ]
+    },
+    "bidamount": {
+        "type": "float",
+        "describe": "min>val:1,min<=val<=max:3,max<val:1",
+        "min": 1000,
+        "max": 1000000000,
+        "score": [
+            1,
+            3,
+            1
+        ]
+    },
     "budget": {
         "type": "float",
         "describe": "min>val:1,min<=val<=max:3,max<val:1",