|
@@ -10,7 +10,6 @@ import (
|
|
|
u "util"
|
|
|
)
|
|
|
|
|
|
-
|
|
|
//单位
|
|
|
var specHeadReg *regexp.Regexp = regexp.MustCompile("^([a-zA-Z]{1,2}[\u4e00-\u9fa5]{6,}|某部|州|自治区|自治州|街道|名称|省|市|县|区|业绩|资格|中标|项目|预算单位)")
|
|
|
var unHanHeadReg *regexp.Regexp = regexp.MustCompile("^([\u4e00-\u9fa5])")
|
|
@@ -18,46 +17,42 @@ var unConReg *regexp.Regexp = regexp.MustCompile("(园|政府|集团|公司|有
|
|
|
var unEndReg *regexp.Regexp = regexp.MustCompile("^.*(公司|学(校)?|博物馆|联合社|合作社|监狱|办公厅|电视台|集团|机构|企业|办公室|委员会|实验室|联社|厂|场|院|所|店|小|台|中心|局|站|城|馆|厅|处|行|科|部|队|联合(会|体)|工作室)$")
|
|
|
var unenableReg1 *regexp.Regexp = regexp.MustCompile("^([\u4e00-\u9fa5]{1,2}(责任|有限|有限股份|有限责任|实业)公司|.*(某部|先生|女士|小姐)|工程技术处)$")
|
|
|
var unenableReg2 *regexp.Regexp = regexp.MustCompile("(\\?|?|单位|#|xxxx|\\*\\*|%|万元|设计企业|免费|代表|代码标识|盖电子|测试测试|删除|错误|吊销|注销|发起人|待清理|&#|护照号|身份证号|\" +\n\t\"法人| |国家拨入|借款|积累资金|认股人|--|、|&|`|美元)")
|
|
|
-//分词
|
|
|
-var GSE *gse.Segmenter = &gse.Segmenter{}
|
|
|
|
|
|
+//分词
|
|
|
+var GSE *gse.Segmenter = &gse.Segmenter{}
|
|
|
|
|
|
//编号
|
|
|
var codeUnConReg *regexp.Regexp = regexp.MustCompile("(null|勘察|测试|设计|设备|项目|标段|工程|监理|范围|分包|月|日|天)")
|
|
|
var codeUnLenReg *regexp.Regexp = regexp.MustCompile("([\u4e00-\u9fa5]{9,})")
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
var classMoneyScope map[string]map[string]interface{}
|
|
|
|
|
|
-
|
|
|
-func init() {
|
|
|
+func init() {
|
|
|
GSE.LoadDict("./web/qua_res/dictionary.txt")
|
|
|
//t>d>p
|
|
|
classMoneyScope = map[string]map[string]interface{}{
|
|
|
- "建筑工程": {"min":10000,"max":10000000000},
|
|
|
- "行政办公": {"min":100,"max":100000000},
|
|
|
- "医疗卫生": {"min":1000,"max":100000000},
|
|
|
- "服务采购": {"min":10,"max":100000000},
|
|
|
- "机械设备": {"min":1000,"max":1000000000},
|
|
|
- "水利水电": {"min":1000,"max":1000000000},
|
|
|
- "能源化工": {"min":1000,"max":1000000000},
|
|
|
- "弱电安防": {"min":1000,"max":1000000000},
|
|
|
- "信息技术": {"min":100,"max":100000000},
|
|
|
- "交通工程": {"min":1000,"max":10000000000},
|
|
|
- "市政设施": {"min":1000,"max":10000000000},
|
|
|
- "农林牧渔": {"min":100,"max":10000000},
|
|
|
+ "建筑工程": {"min": 10000, "max": 10000000000},
|
|
|
+ "行政办公": {"min": 100, "max": 100000000},
|
|
|
+ "医疗卫生": {"min": 1000, "max": 100000000},
|
|
|
+ "服务采购": {"min": 10, "max": 100000000},
|
|
|
+ "机械设备": {"min": 1000, "max": 1000000000},
|
|
|
+ "水利水电": {"min": 1000, "max": 1000000000},
|
|
|
+ "能源化工": {"min": 1000, "max": 1000000000},
|
|
|
+ "弱电安防": {"min": 1000, "max": 1000000000},
|
|
|
+ "信息技术": {"min": 100, "max": 100000000},
|
|
|
+ "交通工程": {"min": 1000, "max": 10000000000},
|
|
|
+ "市政设施": {"min": 1000, "max": 10000000000},
|
|
|
+ "农林牧渔": {"min": 100, "max": 10000000},
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//行业金额校验
|
|
|
-func checkingClassMoney(money float64,class string) bool {
|
|
|
- data :=classMoneyScope[class]
|
|
|
- if data!=nil {
|
|
|
+func checkingClassMoney(money float64, class string) bool {
|
|
|
+ data := classMoneyScope[class]
|
|
|
+ if data != nil {
|
|
|
min := qu.Float64All(data["min"])
|
|
|
max := qu.Float64All(data["max"])
|
|
|
- if money>min && money<max {
|
|
|
+ if money > min && money < max {
|
|
|
return true
|
|
|
}
|
|
|
}
|
|
@@ -65,19 +60,20 @@ func checkingClassMoney(money float64,class string) bool {
|
|
|
}
|
|
|
|
|
|
//企业库检测
|
|
|
-func qyNameIsExistsQYXY(name string) bool{
|
|
|
- q := map[string]interface{}{"company_name": name,}
|
|
|
- data,_ := u.Mgo_QY.FindOne("qyxy_std",q)
|
|
|
- if len(*data)>2 && *data!=nil{
|
|
|
+func qyNameIsExistsQYXY(name string) bool {
|
|
|
+ q := map[string]interface{}{"company_name": name}
|
|
|
+ data, _ := u.Mgo_QY.FindOne("qyxy_std", q)
|
|
|
+ if len(*data) > 2 && *data != nil {
|
|
|
return false
|
|
|
}
|
|
|
return false
|
|
|
}
|
|
|
+
|
|
|
//采购单位库
|
|
|
-func buyerNameIsExists(name string) bool{
|
|
|
- q := map[string]interface{}{"buyer_name": name,}
|
|
|
- data,_ := u.Mgo_QY.FindOne("buyer_enterprise",q)
|
|
|
- if len(*data)>2 && *data!=nil{
|
|
|
+func buyerNameIsExists(name string) bool {
|
|
|
+ q := map[string]interface{}{"buyer_name": name}
|
|
|
+ data, _ := u.Mgo_QY.FindOne("buyer_enterprise", q)
|
|
|
+ if len(*data) > 2 && *data != nil {
|
|
|
return false
|
|
|
}
|
|
|
return false
|
|
@@ -110,30 +106,30 @@ func isHan(str string) bool {
|
|
|
//符号数量
|
|
|
func isCharCount(str string) []int {
|
|
|
//中文,英文,数字,其他
|
|
|
- c1,c2,c3,c4:=0,0,0,0
|
|
|
+ c1, c2, c3, c4 := 0, 0, 0, 0
|
|
|
for _, v := range str {
|
|
|
if unicode.Is(unicode.Han, v) {
|
|
|
c1++
|
|
|
- }else if unicode.IsLetter(v){
|
|
|
+ } else if unicode.IsLetter(v) {
|
|
|
c2++
|
|
|
- } else if unicode.IsNumber(v){
|
|
|
+ } else if unicode.IsNumber(v) {
|
|
|
c3++
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
c4++
|
|
|
}
|
|
|
}
|
|
|
- return []int{c1,c2,c3,c4}
|
|
|
+ return []int{c1, c2, c3, c4}
|
|
|
}
|
|
|
|
|
|
//中文比例-1:3
|
|
|
func isHanLenToLittle(str string) bool {
|
|
|
var count int
|
|
|
len := utf8.RuneCountInString(str)
|
|
|
- min_count := len/3
|
|
|
+ min_count := len / 3
|
|
|
for _, v := range str {
|
|
|
if unicode.Is(unicode.Han, v) {
|
|
|
count++
|
|
|
- if count>=min_count {
|
|
|
+ if count >= min_count {
|
|
|
return true
|
|
|
}
|
|
|
}
|
|
@@ -141,8 +137,6 @@ func isHanLenToLittle(str string) bool {
|
|
|
return false
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
//是否含字母数字
|
|
|
func isAlphanumeric(str string) bool {
|
|
|
var count int
|
|
@@ -157,55 +151,40 @@ func isAlphanumeric(str string) bool {
|
|
|
|
|
|
//连续数字
|
|
|
func isRegTimeDateCode(str string) bool {
|
|
|
- reg:=`\d{8}`
|
|
|
- regx,_ := regexp.Compile(reg)
|
|
|
- if regx.FindString(str)!="" {
|
|
|
+ reg := `\d{8}`
|
|
|
+ regx, _ := regexp.Compile(reg)
|
|
|
+ if regx.FindString(str) != "" {
|
|
|
return false
|
|
|
}
|
|
|
- if utf8.RuneCountInString(str)==8 {
|
|
|
+ if utf8.RuneCountInString(str) == 8 {
|
|
|
return true
|
|
|
}
|
|
|
return false
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
//配置字段初始分
|
|
|
func FieldSourceScore(source map[string]interface{}) map[string]int64 {
|
|
|
- fieldArr := []string{"buyer","s_winner","budget","bidamount","projectname","projectcode"}
|
|
|
- score := make(map[string]int64,0)
|
|
|
- for _,v := range fieldArr{
|
|
|
+ fieldArr := []string{"buyer", "s_winner", "budget", "bidamount", "projectname", "projectcode"}
|
|
|
+ score := make(map[string]int64, 0)
|
|
|
+ for _, v := range fieldArr {
|
|
|
score[v] = int64(100)
|
|
|
}
|
|
|
- for _,key := range fieldArr {
|
|
|
+ for _, key := range fieldArr {
|
|
|
ext := *qu.ObjToMap(source[key])
|
|
|
- if ext!=nil{
|
|
|
- ext_from:=qu.ObjToString(ext["ext_from"])
|
|
|
- ext_type:=qu.ObjToString(ext["ext_type"])
|
|
|
+ if ext != nil {
|
|
|
+ ext_from := qu.ObjToString(ext["ext_from"])
|
|
|
+ ext_type := qu.ObjToString(ext["ext_type"])
|
|
|
//规范ext_from
|
|
|
ext_from = normalizedExtFromName(ext_from)
|
|
|
- if ext_from=="winnerorder" || ext_from=="package" ||
|
|
|
- ext_from=="jsondata" || ext_type=="" {
|
|
|
+ if ext_from == "winnerorder" || ext_from == "package" ||
|
|
|
+ ext_from == "jsondata" || ext_type == "" {
|
|
|
u.Qy_Lock.Lock()
|
|
|
score[key] = qu.Int64All(u.Ext_From[ext_from])
|
|
|
u.Qy_Lock.Unlock()
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
u.Qy_Lock.Lock()
|
|
|
- s := qu.Int64All(u.Ext_From[ext_from])+qu.Int64All(u.Ext_Type[ext_type])
|
|
|
- score[key] = s/2
|
|
|
+ s := qu.Int64All(u.Ext_From[ext_from]) + qu.Int64All(u.Ext_Type[ext_type])
|
|
|
+ score[key] = s / 2
|
|
|
u.Qy_Lock.Unlock()
|
|
|
}
|
|
|
}
|
|
@@ -217,12 +196,12 @@ func FieldSourceScore(source map[string]interface{}) map[string]int64 {
|
|
|
|
|
|
//规范-抽取来源字符串
|
|
|
func normalizedExtFromName(str string) string {
|
|
|
- if strings.Contains(str,"order") {
|
|
|
+ if strings.Contains(str, "order") {
|
|
|
str = "winnerorder"
|
|
|
- }else if strings.Contains(str,"JsonData") {
|
|
|
+ } else if strings.Contains(str, "JsonData") {
|
|
|
str = "jsondata"
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
|
|
|
}
|
|
|
return str
|
|
|
-}
|
|
|
+}
|