Explorar el Código

Merge branch 'dev3.2' of ssh://192.168.3.207:10022/qmx/jy-data-extract into dev3.2

wcj hace 6 años
padre
commit
f52da44307
Se han modificado 2 ficheros con 24 adiciones y 7 borrados
  1. 1 1
      src/jy/pretreated/analytable.go
  2. 23 6
      src/jy/pretreated/colonkv.go

+ 1 - 1
src/jy/pretreated/analytable.go

@@ -93,7 +93,7 @@ var (
 	projectnameReg = regexp.MustCompile("((公开)?招标)*[((第]*[一二三四五六七八九十a-zA-Z0-9]+(标段|包|标|段)[))]*$")
 	MhSpilt        = regexp.MustCompile("[::]")
 	//识别采购单位联系人、联系电话、代理机构联系人、联系电话
-	ContactInfoVagueReg = regexp.MustCompile("邮政编码|邮编|名称|(征求意见|报名审核购买)?((联系人?(及|和)?|办公)?((电话([//]传真|及手机)?|手机)(号码)?|邮箱(地址)?|(地(址|点)))|(联系|收料)(人(姓名)?|方式)|传真|电子邮件|(主要负责|项目(负责|联系)|(项目)?经办)人)|采购方代表")
+	ContactInfoVagueReg = regexp.MustCompile("邮政编码|邮编|名称|(征求意见|报名审核购买)?((联系人?(及|和)?|办公|单位)?((电话([//]传真|及手机)?|手机)(号码)?|邮箱(地址)?|(地(址|点)))|(联系|收料)(人(姓名)?|方式)|传真|电子邮件|(主要负责|项目(负责|联系)|(项目)?经办)人)|采购方代表")
 	ContactInfoMustReg  = regexp.MustCompile("^(" + ContactInfoVagueReg.String() + ")$")
 	ContactType         = map[string]*regexp.Regexp{
 		"采购单位": regexp.MustCompile("(采购(项目.{2}|服务)?|比选|询价|甲|招标(服务)?|建设|委托|发包|业主|使用|谈判|本招标项目经办|征求意见联系|项目实施)(人|单位|部门|机构|机关|(执行)?方$)|(项目|建(库|设))单位|招标人信息|采购中心地址|业主|收料人|采购部"),

+ 23 - 6
src/jy/pretreated/colonkv.go

@@ -353,12 +353,13 @@ func FormatContactKv(kvs *[]*Kv, title string, buyers []string, contactFormat *C
 	//	}
 	startIndex := 0
 	prevKey := ""
-	index, notmatchCount, allMatchCount := 0, 0, 0
+	index, tmpindex, notmatchCount, allMatchCount := 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
 	for kv_index, kv := range *kvs {
 		isBreak := true
 		v := strings.TrimSpace(kv.Value)
@@ -415,6 +416,7 @@ func FormatContactKv(kvs *[]*Kv, title string, buyers []string, contactFormat *C
 			}
 		} else if ascFind {
 			for _, ct_k := range HasOrderContactType(k) {
+				ishad = false
 				//again++
 				if k_length < 3 || k_length > 15 {
 					isBreak = false
@@ -482,6 +484,8 @@ func FormatContactKv(kvs *[]*Kv, title string, buyers []string, contactFormat *C
 				}
 				allMatchCount++
 				if IsMapHasValue(ct_k, indexMap) {
+					ishad = true
+					tmpindex = GetIndex(ct_k, indexMap)
 					isContinue = true
 					continue
 				}
@@ -543,11 +547,15 @@ func FormatContactKv(kvs *[]*Kv, title string, buyers []string, contactFormat *C
 		//		} else if index < 2 {
 		//			index++
 		//		}
-		if prevKey != k {
-			prevKey = k
-			index = 1
-		} else if prevKey == k {
-			index++
+		if ishad {
+			index = tmpindex
+		} else {
+			if prevKey != k {
+				prevKey = k
+				index = 1
+			} else if prevKey == k {
+				index++
+			}
 		}
 		//		if startIndex == 0 || startIndex%2 == 1 || index == 0 {
 		//			index = 1
@@ -908,3 +916,12 @@ func GetMoneyUnit(key, val string) string {
 	}
 	return ""
 }
+
+func GetIndex(ct_k string, indexMap map[int]string) int {
+	for k, v := range indexMap {
+		if ct_k == v {
+			return k
+		}
+	}
+	return 1
+}