|
@@ -385,36 +385,34 @@ func (e *ExtractTask) ExtractDetail(j *ju.Job) {
|
|
|
ExtRuleCore(tmp, e, vc, j)
|
|
|
// log.Debug("抽取-规则", tmp)
|
|
|
|
|
|
+ //抽取-后置规则
|
|
|
+ for _, v := range vc.RuleBacks {
|
|
|
+ ExtRegBack(j, v, e.TaskInfo)
|
|
|
+ }
|
|
|
+ // log.Debug("抽取-后置规则", tmp)
|
|
|
+
|
|
|
//项目名称未能抽取到,标题来凑
|
|
|
if vc.Field == "projectname" && vc.ExtFrom == "title" {
|
|
|
- //if len(j.Result[vc.Field]) < 1 {//如果抽取有结果,不走标题。待验证,暂时标题加入选举逻辑
|
|
|
- field := &ju.ExtField{Field: vc.Field, Code: vc.Id + "_title", RuleText: "title", Type: "title", MatchType: "title", ExtFrom: vc.ExtFrom, SourceValue: j.Title, Value: j.Title}
|
|
|
- if tmp["blocktag"] != nil {
|
|
|
- btag := make(map[string]string)
|
|
|
- for k := range tmp["blocktag"].(map[string]bool) {
|
|
|
- blocktag.Lock()
|
|
|
- btag[k] = TagConfigDesc[k]
|
|
|
- blocktag.Unlock()
|
|
|
+ isextitle := true
|
|
|
+ for _, v := range j.Result[vc.Field] {
|
|
|
+ if len([]rune(qu.ObjToString(v.Value))) > 5 {
|
|
|
+ isextitle = false
|
|
|
+ break
|
|
|
}
|
|
|
- field.BlockTag = btag
|
|
|
}
|
|
|
- j.Result[vc.Field] = append(j.Result[vc.Field], field)
|
|
|
- //}
|
|
|
- }
|
|
|
-
|
|
|
- //抽取-后置规则
|
|
|
- for i := 0; i < 3; i++ {
|
|
|
- for _, v := range vc.RuleBacks {
|
|
|
- ExtRegBack(j, v, e.TaskInfo)
|
|
|
+ if isextitle { //标题加入选举
|
|
|
+ field := &ju.ExtField{Field: vc.Field, Code: vc.Id + "_title", RuleText: "title", Type: "title", MatchType: "title", ExtFrom: vc.ExtFrom, SourceValue: j.Title, Value: j.Title}
|
|
|
+ j.Result[vc.Field] = append(j.Result[vc.Field], field)
|
|
|
+ }
|
|
|
+ for i := 0; i < 3; i++ {
|
|
|
+ for _, v := range vc.RuleBacks {
|
|
|
+ ExtRegBack(j, v, e.TaskInfo)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- // log.Debug("抽取-后置规则", tmp)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //for _, vvc := range j.Result["budget"] {
|
|
|
- //log.Debug("-----", fmt.Sprintf("%+v", vvc))
|
|
|
- //}
|
|
|
//全局后置规则
|
|
|
for _, v := range e.RuleBacks {
|
|
|
ExtRegBack(j, v, e.TaskInfo)
|
|
@@ -787,7 +785,7 @@ func extRegCoreToResult(extfrom, text string, tag *map[string]string, j *ju.Job,
|
|
|
"field": v.Field,
|
|
|
"code": v.Code,
|
|
|
"ruletext": v.RuleText,
|
|
|
- "extfrom": extfrom,
|
|
|
+ "extfrom": text,
|
|
|
"value": val,
|
|
|
"type": "regexp",
|
|
|
"matchtype": "regcontent",
|
|
@@ -824,7 +822,7 @@ func extRegCoreToResult(extfrom, text string, tag *map[string]string, j *ju.Job,
|
|
|
"field": v.Field,
|
|
|
"code": v.Code,
|
|
|
"ruletext": regArr[0],
|
|
|
- "extfrom": extfrom,
|
|
|
+ "extfrom": text,
|
|
|
"value": value,
|
|
|
"type": "regexp",
|
|
|
"matchtype": "regcontent",
|
|
@@ -860,7 +858,7 @@ func extRegCoreToResult(extfrom, text string, tag *map[string]string, j *ju.Job,
|
|
|
"field": v.Field,
|
|
|
"code": v.Code,
|
|
|
"ruletext": v.RuleText,
|
|
|
- "extfrom": extfrom,
|
|
|
+ "extfrom": text,
|
|
|
"value": val,
|
|
|
"type": "regexp",
|
|
|
"matchtype": "regcontent",
|