|
@@ -263,7 +263,7 @@ func FormatContactKv(kvs *[]*Kv, title string, buyers []string, contactFormat *C
|
|
|
//处理联系人信息
|
|
|
var indexMap map[int]string
|
|
|
var matchMap map[string]map[string]bool
|
|
|
- hasMatch := make(map[string]bool)
|
|
|
+ //hasMatch := make(map[string]bool)
|
|
|
if contactFormat == nil || title != "" {
|
|
|
indexMap = map[int]string{}
|
|
|
matchMap = map[string]map[string]bool{}
|
|
@@ -330,7 +330,7 @@ func FormatContactKv(kvs *[]*Kv, title string, buyers []string, contactFormat *C
|
|
|
// }
|
|
|
// }
|
|
|
startIndex := 0
|
|
|
- prevKey := ""
|
|
|
+ //prevKey := ""
|
|
|
index, notmatchCount, allMatchCount := 0, 0, 0
|
|
|
weightMap := map[string]map[string]interface{}{} //权重
|
|
|
mapIndexInKvs := map[string]map[string]interface{}{} //map在数组总的索引位置
|
|
@@ -405,7 +405,7 @@ func FormatContactKv(kvs *[]*Kv, title string, buyers []string, contactFormat *C
|
|
|
}
|
|
|
isAddToMatchMap := false
|
|
|
addToMatchMapKey := ""
|
|
|
- if ContactInfoVagueReg.MatchString(k) {
|
|
|
+ if ContactInfoVagueReg.MatchString(k) { //判断是不是电话、地址。。。
|
|
|
isAddToMatchMap = true
|
|
|
if matchMap[ct_k] == nil {
|
|
|
matchMap[ct_k] = map[string]bool{}
|
|
@@ -450,7 +450,7 @@ func FormatContactKv(kvs *[]*Kv, title string, buyers []string, contactFormat *C
|
|
|
weightMap[ct_k][ct_k] = weightVal.(int)
|
|
|
matchMap[ct_k] = map[string]bool{}
|
|
|
isBreak = false
|
|
|
- prevKey = ""
|
|
|
+ //prevKey = ""
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -463,14 +463,14 @@ func FormatContactKv(kvs *[]*Kv, title string, buyers []string, contactFormat *C
|
|
|
continue
|
|
|
}
|
|
|
isBreak = false
|
|
|
- // if index != 0 || notmatchCount != 0 {
|
|
|
- // startIndex = 0
|
|
|
- // indexMap = map[int]string{}
|
|
|
- // }
|
|
|
+ if index != 0 || notmatchCount != 0 {
|
|
|
+ startIndex = 0
|
|
|
+ indexMap = map[int]string{}
|
|
|
+ }
|
|
|
if startIndex == 0 {
|
|
|
indexMap = map[int]string{}
|
|
|
}
|
|
|
- prevKey = ""
|
|
|
+ //prevKey = ""
|
|
|
startIndex++
|
|
|
indexMap[startIndex] = ct_k
|
|
|
isContinue = true
|
|
@@ -514,28 +514,24 @@ func FormatContactKv(kvs *[]*Kv, title string, buyers []string, contactFormat *C
|
|
|
continue
|
|
|
}
|
|
|
isBreak = false
|
|
|
-
|
|
|
- // if again > 0 {
|
|
|
- // if again%2 == 1 {
|
|
|
- // index = 1
|
|
|
- // } else {
|
|
|
- // index = 2
|
|
|
- // }
|
|
|
- // } else {
|
|
|
- // if prevKey != k {
|
|
|
- // prevKey = k
|
|
|
- // index = 1
|
|
|
- // } else if prevKey == k {
|
|
|
- // index++
|
|
|
- // }
|
|
|
+ // if prevKey != k && !hasMatch[k] {
|
|
|
+ // prevKey = k
|
|
|
+ // index = 1
|
|
|
+ // } else if index < 2 {
|
|
|
+ // index++
|
|
|
+ // }
|
|
|
+ // if prevKey != k {
|
|
|
+ // prevKey = k
|
|
|
+ // index = 1
|
|
|
+ // } else if prevKey == k {
|
|
|
+ // index++
|
|
|
// }
|
|
|
- if prevKey != k && !hasMatch[k] {
|
|
|
- prevKey = k
|
|
|
+ if startIndex == 0 || startIndex%2 == 1 {
|
|
|
index = 1
|
|
|
- } else if index < 2 {
|
|
|
- index++
|
|
|
+ } else if startIndex%2 == 0 {
|
|
|
+ index = 2
|
|
|
}
|
|
|
- hasMatch[k] = true
|
|
|
+ //hasMatch[k] = true
|
|
|
//过滤值
|
|
|
if filterValue.MatchString(v) {
|
|
|
continue
|
|
@@ -682,9 +678,30 @@ func HasOrderContactType(text string) []string {
|
|
|
func GetKVAll(content, title string, contactFormat *ContactFormat, from int) *JobKv {
|
|
|
content = formatText(content, "kv")
|
|
|
m1Kvs, _ := colonkvEntity.entrance(content, title, contactFormat, from)
|
|
|
+ // for _, kvs := range m1Kvs {
|
|
|
+ // qutil.Debug(kvs.Key, kvs.Value)
|
|
|
+ // }
|
|
|
kvTags := GetKvTags(m1Kvs, title, nil)
|
|
|
+ // for k, kvs := range kvTags {
|
|
|
+ // qutil.Debug("kkkkk--", k)
|
|
|
+ // for _, kv := range kvs {
|
|
|
+ // qutil.Debug(kv.Key, kv.Value)
|
|
|
+ // }
|
|
|
+ // }
|
|
|
m2Kvs, m2KvTags := GetKvFromtxt(content, title, from)
|
|
|
+ // for k, kvs := range m2KvTags {
|
|
|
+ // qutil.Debug("kkkkk--", k)
|
|
|
+ // for _, kv := range kvs {
|
|
|
+ // qutil.Debug(kv.Key, kv.Value)
|
|
|
+ // }
|
|
|
+ // }
|
|
|
MergeKvTags(kvTags, m2KvTags)
|
|
|
+ // for k, kvs := range kvTags {
|
|
|
+ // qutil.Debug("kkkkk--", k)
|
|
|
+ // for _, kv := range kvs {
|
|
|
+ // qutil.Debug(kv.Key, kv.Value)
|
|
|
+ // }
|
|
|
+ // }
|
|
|
return &JobKv{
|
|
|
Kvs: m1Kvs,
|
|
|
Kvs_2: m2Kvs,
|
|
@@ -779,13 +796,13 @@ func GetKvTags(findkvs []*Kv, title string, tagdbs []string) map[string][]*Tag {
|
|
|
} else if nextval != "" && utf8.RuneCountInString(nextval) < 30 {
|
|
|
if strings.Contains(nextval, ":") || strings.Contains(nextval, ":") {
|
|
|
if len(strings.Split(nextval, ":")) > 1 || len(strings.Split(nextval, ":")) > 1 {
|
|
|
- tmpnextval := ""
|
|
|
- tmpnextval = strings.Split(nextval, ":")[0]
|
|
|
- tmpnextval = strings.Split(nextval, ":")[0]
|
|
|
- if strings.TrimSpace(tmpnextval) == "" {
|
|
|
+ //tmpnextval := ""
|
|
|
+ nextval = strings.Split(nextval, ":")[0]
|
|
|
+ nextval = strings.Split(nextval, ":")[0]
|
|
|
+ if strings.TrimSpace(nextval) == "" {
|
|
|
continue
|
|
|
}
|
|
|
- if GetAppointTags(tmpnextval, tagdbs).Len() > 0 || GetAppointTags(k, tagdbs).Len() > 0 {
|
|
|
+ if GetAppointTags(nextval, tagdbs).Len() > 0 || GetAppointTags(k, tagdbs).Len() > 0 {
|
|
|
continue
|
|
|
}
|
|
|
}
|