|
@@ -34,16 +34,16 @@ func JsonDataMergeProcessing(j *util.Job, e *ExtractTask) map[string][]*util.Ext
|
|
}
|
|
}
|
|
newNum := clear.DoClearFn(cfn, []interface{}{(*j.Jsondata)[v], ""})
|
|
newNum := clear.DoClearFn(cfn, []interface{}{(*j.Jsondata)[v], ""})
|
|
//if util2.IntAll(newNum[0]) != 0 {
|
|
//if util2.IntAll(newNum[0]) != 0 {
|
|
- extFields := make([]*util.ExtField, 0)
|
|
|
|
- extFields = append(extFields, &util.ExtField{Code: "JsonData_" + v + "_" + fmt.Sprint(jdextweight), Field: v, ExtFrom: "JsonData_" + v + "_" + fmt.Sprint(jdextweight), SourceValue: (*j.Jsondata)[v], Value: newNum[0], Score: 0.1,IsTrue:newNum[len(newNum)-1].(bool)})
|
|
|
|
- j.Result[v] = extFields
|
|
|
|
- //AddExtLog("extract", j.SourceMid, nil, newNum[0], &RegLuaInfo{ "JsonData_"+v, "", v, "", false, nil, nil}, e.TaskInfo) //抽取日志
|
|
|
|
- //AddExtLog("clear", j.SourceMid, (*j.Jsondata)[v], newNum[0], &RegLuaInfo{ "JsonData_"+v, "", v, "", false, nil, nil}, e.TaskInfo) //抽取日志
|
|
|
|
|
|
+ extFields := make([]*util.ExtField, 0)
|
|
|
|
+ extFields = append(extFields, &util.ExtField{Code: "JsonData_" + v + "_" + fmt.Sprint(jdextweight), Field: v, ExtFrom: "JsonData_" + v + "_" + fmt.Sprint(jdextweight), SourceValue: (*j.Jsondata)[v], Value: newNum[0], Score: 0.1, IsTrue: newNum[len(newNum)-1].(bool)})
|
|
|
|
+ j.Result[v] = extFields
|
|
|
|
+ //AddExtLog("extract", j.SourceMid, nil, newNum[0], &RegLuaInfo{ "JsonData_"+v, "", v, "", false, nil, nil}, e.TaskInfo) //抽取日志
|
|
|
|
+ //AddExtLog("clear", j.SourceMid, (*j.Jsondata)[v], newNum[0], &RegLuaInfo{ "JsonData_"+v, "", v, "", false, nil, nil}, e.TaskInfo) //抽取日志
|
|
//}
|
|
//}
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
vv := strings.TrimSpace(util2.ObjToString((*j.Jsondata)[v]))
|
|
vv := strings.TrimSpace(util2.ObjToString((*j.Jsondata)[v]))
|
|
- if vv == ""|| strings.Contains(vv,"详见公告"){
|
|
|
|
|
|
+ if vv == "" || strings.Contains(vv, "详见公告") {
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
lockscore.Lock()
|
|
lockscore.Lock()
|
|
@@ -111,9 +111,9 @@ func JsonDataMergeProcessing(j *util.Job, e *ExtractTask) map[string][]*util.Ext
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if tmpExtField.Score > 0{
|
|
|
|
|
|
+ if tmpExtField.Score > 0 {
|
|
extFields := make([]*util.ExtField, 0)
|
|
extFields := make([]*util.ExtField, 0)
|
|
- extFields = append(extFields,tmpExtField )
|
|
|
|
|
|
+ extFields = append(extFields, tmpExtField)
|
|
j.Result[v] = extFields
|
|
j.Result[v] = extFields
|
|
}
|
|
}
|
|
//AddExtLog("extract", j.SourceMid, nil, (*j.Jsondata)[v], &RegLuaInfo{ "JsonData_"+v, "", v, "", false, nil, nil}, e.TaskInfo) //抽取日志
|
|
//AddExtLog("extract", j.SourceMid, nil, (*j.Jsondata)[v], &RegLuaInfo{ "JsonData_"+v, "", v, "", false, nil, nil}, e.TaskInfo) //抽取日志
|
|
@@ -133,31 +133,37 @@ func JsonDataMergeProcessing(j *util.Job, e *ExtractTask) map[string][]*util.Ext
|
|
}
|
|
}
|
|
newNum := clear.DoClearFn(cfn, []interface{}{(*j.Jsondata)[v], ""})
|
|
newNum := clear.DoClearFn(cfn, []interface{}{(*j.Jsondata)[v], ""})
|
|
//if util2.IntAll(newNum[0]) != 0 {
|
|
//if util2.IntAll(newNum[0]) != 0 {
|
|
- extFields := make([]*util.ExtField, 0)
|
|
|
|
- if jdextweight >1{
|
|
|
|
- if oneScore < 0{
|
|
|
|
- oneScore =0.1
|
|
|
|
- }
|
|
|
|
- extFields = append(extFields, &util.ExtField{Code: "JsonData_" + v + "_" + fmt.Sprint(jdextweight), Field: v, ExtFrom: "JsonData_" + v + "_" + fmt.Sprint(jdextweight), SourceValue: (*j.Jsondata)[v], Value: newNum[0], Score: oneScore+1,IsTrue:newNum[len(newNum)-1].(bool)})
|
|
|
|
- }else {
|
|
|
|
- if oneScore < 0{
|
|
|
|
- oneScore =0.1
|
|
|
|
- }
|
|
|
|
- extFields = append(extFields, &util.ExtField{Code: "JsonData_" + v + "_" + fmt.Sprint(jdextweight), Field: v, ExtFrom: "JsonData_" + v + "_" + fmt.Sprint(jdextweight), SourceValue: (*j.Jsondata)[v], Value: newNum[0], Score: oneScore,IsTrue:newNum[len(newNum)-1].(bool)})
|
|
|
|
|
|
+ extFields := make([]*util.ExtField, 0)
|
|
|
|
+ if jdextweight > 1 {
|
|
|
|
+ if oneScore < 0 {
|
|
|
|
+ oneScore = 0.1
|
|
|
|
+ }
|
|
|
|
+ extFields = append(extFields, &util.ExtField{Code: "JsonData_" + v + "_" + fmt.Sprint(jdextweight), Field: v, ExtFrom: "JsonData_" + v + "_" + fmt.Sprint(jdextweight), SourceValue: (*j.Jsondata)[v], Value: newNum[0], Score: oneScore + 1, IsTrue: newNum[len(newNum)-1].(bool)})
|
|
|
|
+ } else {
|
|
|
|
+ if oneScore < 0 {
|
|
|
|
+ oneScore = 0.1
|
|
}
|
|
}
|
|
- j.Result[v] = append(j.Result[v], extFields...)
|
|
|
|
- //AddExtLog("extract", j.SourceMid, nil, newNum[0], &RegLuaInfo{ "JsonData_"+v, "", v, "", false, nil, nil}, e.TaskInfo) //抽取日志
|
|
|
|
- //AddExtLog("clear", j.SourceMid, (*j.Jsondata)[v], newNum[0], &RegLuaInfo{ "JsonData_"+v, "", v, "", false, nil, nil}, e.TaskInfo) //抽取日志
|
|
|
|
|
|
+ extFields = append(extFields, &util.ExtField{Code: "JsonData_" + v + "_" + fmt.Sprint(jdextweight), Field: v, ExtFrom: "JsonData_" + v + "_" + fmt.Sprint(jdextweight), SourceValue: (*j.Jsondata)[v], Value: newNum[0], Score: oneScore, IsTrue: newNum[len(newNum)-1].(bool)})
|
|
|
|
+ }
|
|
|
|
+ j.Result[v] = append(j.Result[v], extFields...)
|
|
|
|
+ //AddExtLog("extract", j.SourceMid, nil, newNum[0], &RegLuaInfo{ "JsonData_"+v, "", v, "", false, nil, nil}, e.TaskInfo) //抽取日志
|
|
|
|
+ //AddExtLog("clear", j.SourceMid, (*j.Jsondata)[v], newNum[0], &RegLuaInfo{ "JsonData_"+v, "", v, "", false, nil, nil}, e.TaskInfo) //抽取日志
|
|
//}
|
|
//}
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
|
|
|
|
if strings.Trim(util2.ObjToString(j.Result[v][0].Value), " ") != strings.Trim(util2.ObjToString((*j.Jsondata)[v]), " ") {
|
|
if strings.Trim(util2.ObjToString(j.Result[v][0].Value), " ") != strings.Trim(util2.ObjToString((*j.Jsondata)[v]), " ") {
|
|
- tmp = append(tmp, j.Result[v][0])
|
|
|
|
|
|
+ jdtmp := &util.ExtField{j.Result[v][0].BlockTag,
|
|
|
|
+ j.Result[v][0].Field, j.Result[v][0].Code, j.Result[v][0].RuleText,
|
|
|
|
+ j.Result[v][0].Type, j.Result[v][0].MatchType, j.Result[v][0].ExtFrom,
|
|
|
|
+ j.Result[v][0].SourceValue, j.Result[v][0].Value, j.Result[v][0].Score,
|
|
|
|
+ j.Result[v][0].ScoreItem, j.Result[v][0].Weight, j.Result[v][0].ValRepeat,
|
|
|
|
+ j.Result[v][0].IsTrue}
|
|
|
|
+ tmp = append(tmp, jdtmp)
|
|
if jdextweight == 2 {
|
|
if jdextweight == 2 {
|
|
oneScore += 2
|
|
oneScore += 2
|
|
}
|
|
}
|
|
- tmp = append(tmp, &util.ExtField{Code: "JsonData_" + v + "_" + fmt.Sprint(jdextweight), Field: v, ExtFrom: "JsonData_" + v + "_" + fmt.Sprint(jdextweight), SourceValue: (*j.Jsondata)[v], Value: strings.Trim(util2.ObjToString((*j.Jsondata)[v]), " "), Score: oneScore})
|
|
|
|
|
|
+ tmp = append(tmp, &util.ExtField{Code: "JsonData_" + v + "_" + fmt.Sprint(jdextweight), Field: v, ExtFrom: "JsonData_" + v + "_" + fmt.Sprint(jdextweight), SourceValue: (*j.Jsondata)[v], Value: strings.Trim(util2.ObjToString((*j.Jsondata)[v]), " "), Score: oneScore, ScoreItem: []*util.ScoreItem{}})
|
|
//AddExtLog("extract", j.SourceMid, j.Result[v], (*j.Jsondata)[v], &RegLuaInfo{ "JsonData_"+v, "", v, "", false, nil, nil}, e.TaskInfo) //抽取日志
|
|
//AddExtLog("extract", j.SourceMid, j.Result[v], (*j.Jsondata)[v], &RegLuaInfo{ "JsonData_"+v, "", v, "", false, nil, nil}, e.TaskInfo) //抽取日志
|
|
//AddExtLog("clear", j.SourceMid, j.Result[v], (*j.Jsondata)[v], &RegLuaInfo{ "JsonData_"+v, "", v, "", false, nil, nil}, e.TaskInfo) //抽取日志
|
|
//AddExtLog("clear", j.SourceMid, j.Result[v], (*j.Jsondata)[v], &RegLuaInfo{ "JsonData_"+v, "", v, "", false, nil, nil}, e.TaskInfo) //抽取日志
|
|
tmps[v] = tmp
|
|
tmps[v] = tmp
|
|
@@ -242,7 +248,7 @@ func JsonDataMergeProcessing(j *util.Job, e *ExtractTask) map[string][]*util.Ext
|
|
|
|
|
|
for k, v := range tmps { //新打分的结果集放入到result中,v为数组只有2个值
|
|
for k, v := range tmps { //新打分的结果集放入到result中,v为数组只有2个值
|
|
if v[0].Score == v[1].Score { //分数相等优先取打分的值
|
|
if v[0].Score == v[1].Score { //分数相等优先取打分的值
|
|
- if v[0].ExtFrom == "JsonData_"+k + "_" + fmt.Sprint(jdextweight){
|
|
|
|
|
|
+ if v[0].ExtFrom == "JsonData_"+k+"_"+fmt.Sprint(jdextweight) {
|
|
j.Result[k] = append(j.Result[k], v[1])
|
|
j.Result[k] = append(j.Result[k], v[1])
|
|
} else {
|
|
} else {
|
|
j.Result[k] = append(j.Result[k], v[0])
|
|
j.Result[k] = append(j.Result[k], v[0])
|