|
@@ -296,6 +296,7 @@ func FormatContactKv(kvs *[]*Kv, title string, buyers []string, contactFormat *C
|
|
|
//采购人在联系人、电话后面的处理
|
|
|
//qutil.Debug("indexMap---", indexMap)
|
|
|
//qutil.Debug("ascFind---", ascFind, "ascFindFlag---", ascFindFlag, "isCanAddToIndex---", isCanAddToIndexMap)
|
|
|
+ //qutil.Debug("+++++++++++++++++++++++++++++++++++++++++", title)
|
|
|
for _, kv := range *kvs {
|
|
|
isCanAddToIndexMap := false
|
|
|
k := FilterContactKey(kv.Key) //过滤key
|
|
@@ -368,25 +369,32 @@ func FormatContactKv(kvs *[]*Kv, title string, buyers []string, contactFormat *C
|
|
|
//qutil.Debug("=========================================================")
|
|
|
startIndex := 0
|
|
|
prevKey := ""
|
|
|
- index, tmpindex, notmatchCount, allMatchCount := 0, 0, 0, 0
|
|
|
+ index, tmpindex, notmatchCount, allMatchCount, keyNotMatchContactInfoCount := 0, 0, 0, 0, 0
|
|
|
weightMap := map[string]map[string]interface{}{} //权重
|
|
|
mapIndexInKvs := map[string]map[string]interface{}{} //map在数组总的索引位置
|
|
|
kvsTemp := make([]*Kv, len(*kvs))
|
|
|
copy(kvsTemp, *kvs)
|
|
|
//again := 0
|
|
|
ishad := false
|
|
|
- afterWinner := false
|
|
|
for kv_index, kv := range *kvs {
|
|
|
isBreak := true
|
|
|
v := strings.TrimSpace(kv.Value)
|
|
|
//根据采购单位分析
|
|
|
isContinue := false
|
|
|
k := FilterContactKey(kv.Key)
|
|
|
+ //qutil.Debug(kv.Key, k)
|
|
|
k_length := len([]rune(k))
|
|
|
//3.4新增winnerperson和winnertel抽取
|
|
|
- if indexMap[1] == "中标单位" && ContactInfoMustReg.MatchString(k) { //中标后是否出现电话、联系人、地址等信息
|
|
|
- //qutil.Debug("kkkkkk:", k, indexMap)
|
|
|
- afterWinner = true
|
|
|
+ if len(indexMap) == 1 && indexMap[1] == "中标单位" {
|
|
|
+ if !ContactInfoVagueReg.MatchString(k) { // 5c7f61dea5cb26b9b7d7bbee
|
|
|
+ keyNotMatchContactInfoCount++
|
|
|
+ }
|
|
|
+ //qutil.Debug(k, "==========keyNotMatchContactInfoCount+++", keyNotMatchContactInfoCount)
|
|
|
+ if keyNotMatchContactInfoCount >= 1 {
|
|
|
+ indexMap = map[int]string{}
|
|
|
+ startIndex = 0
|
|
|
+ keyNotMatchContactInfoCount = 0
|
|
|
+ }
|
|
|
}
|
|
|
//qutil.Debug(kv.Key, "++++++++++", kv.Value, buyers != nil, ascFind, isContinue)
|
|
|
if buyers != nil {
|
|
@@ -455,6 +463,7 @@ func FormatContactKv(kvs *[]*Kv, title string, buyers []string, contactFormat *C
|
|
|
}
|
|
|
isAddToMatchMap := false
|
|
|
addToMatchMapKey := ""
|
|
|
+ //qutil.Debug("ContactInfoVagueReg.MatchString(k)+++", ContactInfoVagueReg.MatchString(k))
|
|
|
if ContactInfoVagueReg.MatchString(k) { //判断是不是电话、地址。。。
|
|
|
isAddToMatchMap = true
|
|
|
if matchMap[ct_k] == nil {
|
|
@@ -488,7 +497,7 @@ func FormatContactKv(kvs *[]*Kv, title string, buyers []string, contactFormat *C
|
|
|
}
|
|
|
}
|
|
|
addToMatchMapKey = k
|
|
|
- if ct_k == "采购单位" {
|
|
|
+ if ct_k == "采购单位" { // || ct_k == "中标单位"
|
|
|
k = ContactType[ct_k].FindString(k)
|
|
|
}
|
|
|
}
|
|
@@ -515,6 +524,7 @@ func FormatContactKv(kvs *[]*Kv, title string, buyers []string, contactFormat *C
|
|
|
continue
|
|
|
}
|
|
|
isBreak = false
|
|
|
+ //qutil.Debug("index+++", index, "notmatchCount+++", notmatchCount)
|
|
|
if index != 0 || notmatchCount != 0 {
|
|
|
startIndex = 0
|
|
|
indexMap = map[int]string{}
|
|
@@ -528,12 +538,6 @@ func FormatContactKv(kvs *[]*Kv, title string, buyers []string, contactFormat *C
|
|
|
isContinue = true
|
|
|
}
|
|
|
}
|
|
|
- //qutil.Debug(len(indexMap), !afterWinner)
|
|
|
- if len(indexMap) == 2 && !afterWinner { //处理同时出现winner、buyer、agency 5d6b2aa2a5cb26b9b73e79d3
|
|
|
- //qutil.Debug("+++++++++++++++++++")
|
|
|
- delete(indexMap, 1)
|
|
|
- indexMap = map[int]string{1: indexMap[2]}
|
|
|
- }
|
|
|
//qutil.Debug("isContinue+++", isContinue, indexMap)
|
|
|
if isContinue {
|
|
|
continue
|
|
@@ -552,16 +556,25 @@ func FormatContactKv(kvs *[]*Kv, title string, buyers []string, contactFormat *C
|
|
|
isBreak = false
|
|
|
continue
|
|
|
}
|
|
|
+ //qutil.Debug("ContactInfoMustReg.MatchString(k)+++", !ContactInfoMustReg.MatchString(k))
|
|
|
if !ContactInfoMustReg.MatchString(k) { //判断是否是电话、邮箱、地址等信息
|
|
|
+ if OtherContactType.MatchString(k) { //匹配到投诉和监督 5bc9683ea5cb26b9b72b2302 5c35f3e8a5cb26b9b72dcdbd
|
|
|
+ startIndex = 0
|
|
|
+ //notmatchCount = 0
|
|
|
+ indexMap = map[int]string{}
|
|
|
+ continue
|
|
|
+ }
|
|
|
if mustMatchFirst {
|
|
|
mustMatchFirst = false
|
|
|
continue
|
|
|
}
|
|
|
+ //qutil.Debug("buyers == nil+++", buyers == nil, "len(totalIndexMap)+++", len(totalIndexMap))
|
|
|
if buyers == nil && len(totalIndexMap) != 0 {
|
|
|
isBreak = false
|
|
|
}
|
|
|
//允许有这么多个匹配不上的key
|
|
|
notmatchCount++
|
|
|
+ //qutil.Debug("notmatchCount+++", notmatchCount, "len(indexMap)*2+++", len(indexMap)*2, "contactFormat+++", contactFormat == nil, "ascFind+++", ascFind)
|
|
|
if notmatchCount < len(indexMap)*2 {
|
|
|
isBreak = false
|
|
|
} else if contactFormat == nil && ascFind {
|
|
@@ -655,6 +668,7 @@ func FormatContactKv(kvs *[]*Kv, title string, buyers []string, contactFormat *C
|
|
|
kvTemp.Value = v
|
|
|
//qutil.Debug(kvTemp.Key, "----------------", kvTemp.Value)
|
|
|
(*kvs)[kv_index] = &kvTemp
|
|
|
+ //qutil.Debug("ascFind++", ascFind, "isBreak++", isBreak, "len(indexMap)++", len(indexMap))
|
|
|
if ascFind && isBreak && len(indexMap) > 0 {
|
|
|
break
|
|
|
}
|