zhangjinkun 6 år sedan
förälder
incheckning
6954e00428
3 ändrade filer med 8 tillägg och 6 borttagningar
  1. 4 4
      src/jy/extract/extract.go
  2. 2 0
      src/jy/extract/score.go
  3. 2 2
      src/res/fieldscore.json

+ 4 - 4
src/jy/extract/extract.go

@@ -386,8 +386,8 @@ func (e *ExtractTask) ExtractDetail(j *ju.Job) {
 				if vc.Field == "projectname" {
 					//if len(j.Result[vc.Field]) < 1 {//如果抽取有结果,不走标题。待验证,暂时标题加入选举逻辑
 					items := make([]*ju.ScoreItem, 1)
-					items[0] = &ju.ScoreItem{Des: "项目名称未能抽取到,标题来凑初始化", ExtFrom: "title", Value: j.Title, Score: 4}
-					field := &ju.ExtField{Field: vc.Field, Code: "title", RuleText: "title", Type: "title", MatchType: "title", ExtFrom: vc.ExtFrom, SourceValue: j.Title, Value: j.Title, Score: 4, ScoreItem: items}
+					items[0] = &ju.ScoreItem{Des: "项目名称未能抽取到,标题来凑初始化", ExtFrom: "title", Value: j.Title, Score: TitleScore}
+					field := &ju.ExtField{Field: vc.Field, Code: "title", RuleText: "title", Type: "title", MatchType: "title", ExtFrom: vc.ExtFrom, SourceValue: j.Title, Value: j.Title, Score: TitleScore, ScoreItem: items}
 					if tmp["blocktag"] != nil {
 						field.BlockTag = tmp["blocktag"].(map[string]bool)
 					}
@@ -623,14 +623,14 @@ func ExtRegCore(extfrom string, doc map[string]interface{}, j *ju.Job, in *RegLu
 					for _, tmp := range tmps {
 						field := &ju.ExtField{Field: k, Code: qu.ObjToString(tmp["code"]), RuleText: qu.ObjToString(tmp["ruletext"]), Type: qu.ObjToString(tmp["type"]), MatchType: qu.ObjToString(tmp["matchtype"]), ExtFrom: extfrom, SourceValue: tmp["sourcevalue"], Value: tmp["value"]}
 						if extfrom == "title" {
-							field.Score = 4
+							field.Score = TitleScore
 						}
 						if tmp["blocktag"] != nil {
 							field.BlockTag = tmp["blocktag"].(map[string]bool)
 						}
 						item := &ju.ScoreItem{Des: "初始化", Code: qu.ObjToString(tmp["code"]), RuleText: qu.ObjToString(tmp["ruletext"]), Type: qu.ObjToString(tmp["type"]), MatchType: qu.ObjToString(tmp["matchtype"]), ExtFrom: extfrom, Value: tmp["value"]}
 						if extfrom == "title" {
-							item.Score = 4
+							item.Score = TitleScore
 						}
 						if tmp["scoreitem"] == nil {
 							scoreItems := make([]*ju.ScoreItem, 0)

+ 2 - 0
src/jy/extract/score.go

@@ -14,10 +14,12 @@ import (
 
 var SoreConfig map[string]map[string]interface{}
 var TagConfig map[string]map[string]float64
+var TitleScore float64
 
 func init() {
 	qu.ReadConfig("./res/tagscore.json", &TagConfig)
 	qu.ReadConfig("./res/fieldscore.json", &SoreConfig)
+	TitleScore = qu.Float64All(SoreConfig["extractype"]["title"])
 	//实例化正则
 	for _, tmp := range SoreConfig {
 		//log.Println(tmp)

+ 2 - 2
src/res/fieldscore.json

@@ -1,7 +1,7 @@
 {
     "extractype": {
         "describe": "抽取类型打分",
-        "title": 4,
+        "title": 2,
         "table": 3,
         "colon": 3,
         "space": 3,
@@ -32,7 +32,7 @@
         "length": [
             {
                 "describe": "长度打分min>val:-6,min<=val<=max:1,max<val:-1",
-                "min": 5,
+                "min": 4,
                 "max": 35,
                 "score": [
                     -10,