package main import ( qu "qfw/util" "unicode/utf8" ) func projectnameFieldScore(tmp map[string]interface{}) (map[string]interface{}) { projectname := qu.ObjToString(tmp["projectname"]) score := int64(100) reason:="" /*错误项*/ if utf8.RuneCountInString(projectname) <= 6 || !isHan(projectname) { return map[string]interface{}{ "score":int64(0), "reason":"错误项", } } /*减分项*/ //长度过长 if utf8.RuneCountInString(projectname) >= 25 { reason+="~过长-1" score -= 1 } //标题切词与名称比对-待开发 //符号数量 countArr := isCharCount(projectname) if countArr[3] > 3 { reason+="~符号-2" score -= 2 } //中文-长度-比例 if !isHanLenToLittle(projectname) { reason+="~中文比例-2" score -= 2 } return map[string]interface{}{ "score":score, "reason":reason, } }