|
@@ -1,28 +1,31 @@
|
|
package main
|
|
package main
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
+ "data_ai/extract"
|
|
"data_ai/tool"
|
|
"data_ai/tool"
|
|
"data_ai/udp"
|
|
"data_ai/udp"
|
|
"data_ai/ul"
|
|
"data_ai/ul"
|
|
"fmt"
|
|
"fmt"
|
|
log "github.com/donnie4w/go-logger/logger"
|
|
log "github.com/donnie4w/go-logger/logger"
|
|
- "github.com/gogf/gf/v2/util/gconv"
|
|
|
|
qu "jygit.jydev.jianyu360.cn/data_processing/common_utils"
|
|
qu "jygit.jydev.jianyu360.cn/data_processing/common_utils"
|
|
"strings"
|
|
"strings"
|
|
"sync"
|
|
"sync"
|
|
- "unicode/utf8"
|
|
|
|
)
|
|
)
|
|
|
|
|
|
func init() {
|
|
func init() {
|
|
- ul.IsLocal = false //是否本地
|
|
|
|
- ul.IsTool = false //是否工具
|
|
|
|
- ul.IsFull = false //是否全量
|
|
|
|
|
|
+ ul.IsLocal = true //是否本地
|
|
|
|
+ ul.IsTool = false //是否工具
|
|
|
|
+ ul.IsFull = false //是否全量
|
|
if ul.IsTool {
|
|
if ul.IsTool {
|
|
ul.InitToolVar()
|
|
ul.InitToolVar()
|
|
} else {
|
|
} else {
|
|
ul.InitGlobalVar()
|
|
ul.InitGlobalVar()
|
|
if !ul.IsFull {
|
|
if !ul.IsFull {
|
|
- udp.InitProcessVar()
|
|
|
|
|
|
+ if ul.ModelType == "deepseek" {
|
|
|
|
+ go extract.RunDeepSeek()
|
|
|
|
+ } else {
|
|
|
|
+ udp.InitProcessVar()
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if !ul.IsTool {
|
|
if !ul.IsTool {
|
|
@@ -39,11 +42,51 @@ func main() {
|
|
tool.StartToolInfo()
|
|
tool.StartToolInfo()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- //extract.TestSingleFieldInfo("bidding", "677cf41c3309c0998bb6ddda")
|
|
|
|
|
|
+ update1()
|
|
lock := make(chan bool)
|
|
lock := make(chan bool)
|
|
<-lock
|
|
<-lock
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+func update1() {
|
|
|
|
+ dataArr, _ := ul.BidMgo.Find("zktest_sample_data", map[string]interface{}{}, nil, map[string]interface{}{"_id": 1})
|
|
|
|
+ for _, v := range dataArr {
|
|
|
|
+ tmpid := ul.BsonTOStringId(v["_id"])
|
|
|
|
+ data := ul.BidMgo.FindById("zktest_sample_data_source_0", tmpid)
|
|
|
|
+ title := qu.ObjToString(data["title"])
|
|
|
|
+ detail := qu.ObjToString(data["detail"])
|
|
|
|
+ ul.BidMgo.UpdateById("zktest_sample_data", tmpid, map[string]interface{}{
|
|
|
|
+ "$set": map[string]interface{}{
|
|
|
|
+ "detail": title + "\n" + detail,
|
|
|
|
+ },
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ log.Debug("is over ...")
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+func export1() {
|
|
|
|
+ dataArr, _ := ul.BidMgo.Find("zktest_sample_data", map[string]interface{}{}, nil, map[string]interface{}{"_id": 1})
|
|
|
|
+ pool_mgo := make(chan bool, 1)
|
|
|
|
+ wg_mgo := &sync.WaitGroup{}
|
|
|
|
+ for _, v := range dataArr {
|
|
|
|
+ pool_mgo <- true
|
|
|
|
+ wg_mgo.Add(1)
|
|
|
|
+ go func(tmp map[string]interface{}) {
|
|
|
|
+ defer func() {
|
|
|
|
+ <-pool_mgo
|
|
|
|
+ wg_mgo.Done()
|
|
|
|
+ }()
|
|
|
|
+ tmpid := ul.BsonTOStringId(v["_id"])
|
|
|
|
+ data := ul.BidMgo.FindById("bidding", tmpid)
|
|
|
|
+ if len(data) == 0 || data == nil {
|
|
|
|
+ log.Debug("异常")
|
|
|
|
+ }
|
|
|
|
+ ul.BidMgo.Save("zktest_sample_data_source_4", data)
|
|
|
|
+ }(v)
|
|
|
|
+ }
|
|
|
|
+ wg_mgo.Wait()
|
|
|
|
+ log.Debug("is over ...")
|
|
|
|
+}
|
|
|
|
+
|
|
// 对比程序
|
|
// 对比程序
|
|
func compare1() {
|
|
func compare1() {
|
|
fields := map[string]string{
|
|
fields := map[string]string{
|
|
@@ -58,80 +101,76 @@ func compare1() {
|
|
"budget": "float",
|
|
"budget": "float",
|
|
"bidamount": "float",
|
|
"bidamount": "float",
|
|
}
|
|
}
|
|
- dataArr, _ := ul.BidMgo.Find("zktest_sample_data", map[string]interface{}{}, nil, map[string]interface{}{})
|
|
|
|
- dataArr1, _ := ul.BidMgo.Find("zktest_sample_data_source_1", map[string]interface{}{}, nil, map[string]interface{}{})
|
|
|
|
- dataArr2, _ := ul.BidMgo.Find("zktest_sample_data_source_2", map[string]interface{}{}, nil, map[string]interface{}{})
|
|
|
|
- dataArr3, _ := ul.BidMgo.Find("zktest_sample_data_source_3", map[string]interface{}{}, nil, map[string]interface{}{})
|
|
|
|
-
|
|
|
|
- biaozhu := creat(dataArr, false) //标注数据···
|
|
|
|
- source1 := creat(dataArr1, true)
|
|
|
|
- source2 := creat(dataArr2, true)
|
|
|
|
- source3 := creat(dataArr3, true)
|
|
|
|
-
|
|
|
|
- log.Debug("数据源:", len(biaozhu))
|
|
|
|
- log.Debug("对比源:", len(source1))
|
|
|
|
- log.Debug("对比源:", len(source2))
|
|
|
|
- log.Debug("对比源:", len(source3))
|
|
|
|
- dataArr = nil
|
|
|
|
|
|
+ dataArr1, _ := ul.BidMgo.Find("zktest_sample_data", map[string]interface{}{}, nil, map[string]interface{}{})
|
|
|
|
+ dataArr2, _ := ul.BidMgo.Find("zktest_deepseek_0122", map[string]interface{}{}, nil, map[string]interface{}{})
|
|
|
|
+ biaozhu := creat(dataArr1, false) //标注数据···
|
|
|
|
+ deepseek := creat(dataArr2, true)
|
|
dataArr1 = nil
|
|
dataArr1 = nil
|
|
dataArr2 = nil
|
|
dataArr2 = nil
|
|
- dataArr3 = nil
|
|
|
|
//计数
|
|
//计数
|
|
- tj1 := duibi(fields, biaozhu, source1)
|
|
|
|
- tj2 := duibi(fields, biaozhu, source2)
|
|
|
|
- tj3 := duibi(fields, biaozhu, source3)
|
|
|
|
-
|
|
|
|
|
|
+ tj := duibi(fields, biaozhu, deepseek)
|
|
log.Debug("...................")
|
|
log.Debug("...................")
|
|
arr := []string{"toptype", "subtype", "area", "city", "projectname", "projectcode", "buyer", "budget", "s_winner", "bidamount"}
|
|
arr := []string{"toptype", "subtype", "area", "city", "projectname", "projectcode", "buyer", "budget", "s_winner", "bidamount"}
|
|
for _, v := range arr {
|
|
for _, v := range arr {
|
|
- t1, s1 := tj1[v]["total"], tj1[v]["same"]
|
|
|
|
- t2, s2 := tj2[v]["total"], tj2[v]["same"]
|
|
|
|
- t3, s3 := tj3[v]["total"], tj3[v]["same"]
|
|
|
|
|
|
+ t1, s1 := tj[v]["total"], tj[v]["same"]
|
|
f1 := fmt.Sprintf("模型flash~字段:%s 总计:%d 一致:%d 一致率:%.2f%s", v, t1, s1, (float64(s1)/float64(t1))*100.0, "%")
|
|
f1 := fmt.Sprintf("模型flash~字段:%s 总计:%d 一致:%d 一致率:%.2f%s", v, t1, s1, (float64(s1)/float64(t1))*100.0, "%")
|
|
- f2 := fmt.Sprintf("模型air~字段:%s 总计:%d 一致:%d 一致率:%.2f%s", v, t2, s2, (float64(s2)/float64(t2))*100.0, "%")
|
|
|
|
- f3 := fmt.Sprintf("模型deepseek~字段:%s 总计:%d 一致:%d 一致率:%.2f%s", v, t3, s3, (float64(s3)/float64(t3))*100.0, "%")
|
|
|
|
log.Debug(f1)
|
|
log.Debug(f1)
|
|
- log.Debug(f2)
|
|
|
|
- log.Debug(f3)
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
// 构建数据
|
|
// 构建数据
|
|
-func creat(dataArr []map[string]interface{}, is_zhipu bool) map[string]map[string]interface{} {
|
|
|
|
|
|
+func creat(dataArr []map[string]interface{}, deepseek bool) map[string]map[string]interface{} {
|
|
dict := map[string]map[string]interface{}{}
|
|
dict := map[string]map[string]interface{}{}
|
|
for _, biaozhu := range dataArr {
|
|
for _, biaozhu := range dataArr {
|
|
- if is_zhipu {
|
|
|
|
- ai_zhipu := *qu.ObjToMap(biaozhu["ai_zhipu"])
|
|
|
|
- if len(ai_zhipu) > 0 {
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
- continue
|
|
|
|
- }
|
|
|
|
|
|
+ if deepseek {
|
|
|
|
+ tmpid := ul.BsonTOStringId(biaozhu["_id"])
|
|
|
|
+ toptype := qu.ObjToString(biaozhu["s_toptype"])
|
|
|
|
+ subtype := qu.ObjToString(biaozhu["s_subtype"])
|
|
|
|
+ area := qu.ObjToString(biaozhu["s_area"])
|
|
|
|
+ city := qu.ObjToString(biaozhu["s_city"])
|
|
|
|
+ projectname := qu.ObjToString(biaozhu["s_projectname"])
|
|
|
|
+ projectcode := qu.ObjToString(biaozhu["s_projectcode"])
|
|
|
|
+ budget := qu.Float64All(biaozhu["s_budget"])
|
|
|
|
+ bidamount := qu.Float64All(biaozhu["s_bidamount"])
|
|
|
|
+ buyer := qu.ObjToString(biaozhu["s_buyer"])
|
|
|
|
+ s_winner := qu.ObjToString(biaozhu["s_winner"])
|
|
|
|
+ info := map[string]interface{}{}
|
|
|
|
+ info["toptype"] = toptype
|
|
|
|
+ info["subtype"] = subtype
|
|
|
|
+ info["area"] = area
|
|
|
|
+ info["city"] = city
|
|
|
|
+ info["projectname"] = projectname
|
|
|
|
+ info["projectcode"] = projectcode
|
|
|
|
+ info["budget"] = budget
|
|
|
|
+ info["bidamount"] = bidamount
|
|
|
|
+ info["buyer"] = buyer
|
|
|
|
+ info["s_winner"] = s_winner
|
|
|
|
+ dict[tmpid] = info
|
|
|
|
+ } else {
|
|
|
|
+ tmpid := ul.BsonTOStringId(biaozhu["_id"])
|
|
|
|
+ toptype := qu.ObjToString(biaozhu["toptype"])
|
|
|
|
+ subtype := qu.ObjToString(biaozhu["subtype"])
|
|
|
|
+ area := qu.ObjToString(biaozhu["area"])
|
|
|
|
+ city := qu.ObjToString(biaozhu["city"])
|
|
|
|
+ projectname := qu.ObjToString(biaozhu["projectname"])
|
|
|
|
+ projectcode := qu.ObjToString(biaozhu["projectcode"])
|
|
|
|
+ budget := qu.Float64All(biaozhu["budget"])
|
|
|
|
+ bidamount := qu.Float64All(biaozhu["bidamount"])
|
|
|
|
+ buyer := qu.ObjToString(biaozhu["buyer"])
|
|
|
|
+ s_winner := qu.ObjToString(biaozhu["s_winner"])
|
|
|
|
+ info := map[string]interface{}{}
|
|
|
|
+ info["toptype"] = toptype
|
|
|
|
+ info["subtype"] = subtype
|
|
|
|
+ info["area"] = area
|
|
|
|
+ info["city"] = city
|
|
|
|
+ info["projectname"] = projectname
|
|
|
|
+ info["projectcode"] = projectcode
|
|
|
|
+ info["budget"] = budget
|
|
|
|
+ info["bidamount"] = bidamount
|
|
|
|
+ info["buyer"] = buyer
|
|
|
|
+ info["s_winner"] = s_winner
|
|
|
|
+ dict[tmpid] = info
|
|
}
|
|
}
|
|
- tmpid := ul.BsonTOStringId(biaozhu["_id"])
|
|
|
|
- toptype := qu.ObjToString(biaozhu["toptype"])
|
|
|
|
- subtype := qu.ObjToString(biaozhu["subtype"])
|
|
|
|
- area := qu.ObjToString(biaozhu["area"])
|
|
|
|
- city := qu.ObjToString(biaozhu["city"])
|
|
|
|
- projectname := qu.ObjToString(biaozhu["projectname"])
|
|
|
|
- projectcode := qu.ObjToString(biaozhu["projectcode"])
|
|
|
|
- budget := qu.Float64All(biaozhu["budget"])
|
|
|
|
- bidamount := qu.Float64All(biaozhu["bidamount"])
|
|
|
|
- buyer := qu.ObjToString(biaozhu["buyer"])
|
|
|
|
- s_winner := qu.ObjToString(biaozhu["s_winner"])
|
|
|
|
-
|
|
|
|
- info := map[string]interface{}{}
|
|
|
|
- info["toptype"] = toptype
|
|
|
|
- info["subtype"] = subtype
|
|
|
|
- info["area"] = area
|
|
|
|
- info["city"] = city
|
|
|
|
- info["projectname"] = projectname
|
|
|
|
- info["projectcode"] = projectcode
|
|
|
|
- info["budget"] = budget
|
|
|
|
- info["bidamount"] = bidamount
|
|
|
|
- info["buyer"] = buyer
|
|
|
|
- info["s_winner"] = s_winner
|
|
|
|
- dict[tmpid] = info
|
|
|
|
}
|
|
}
|
|
return dict
|
|
return dict
|
|
}
|
|
}
|
|
@@ -183,88 +222,7 @@ func duibi(fields map[string]string, biaozhu map[string]map[string]interface{},
|
|
return tj
|
|
return tj
|
|
}
|
|
}
|
|
|
|
|
|
-func export1() {
|
|
|
|
- dataArr, _ := ul.BidMgo.Find("zktest_sample_data", map[string]interface{}{}, nil, map[string]interface{}{"_id": 1})
|
|
|
|
- pool_mgo := make(chan bool, 1)
|
|
|
|
- wg_mgo := &sync.WaitGroup{}
|
|
|
|
- for _, v := range dataArr {
|
|
|
|
- pool_mgo <- true
|
|
|
|
- wg_mgo.Add(1)
|
|
|
|
- go func(tmp map[string]interface{}) {
|
|
|
|
- defer func() {
|
|
|
|
- <-pool_mgo
|
|
|
|
- wg_mgo.Done()
|
|
|
|
- }()
|
|
|
|
- tmpid := ul.BsonTOStringId(v["_id"])
|
|
|
|
- data := ul.BidMgo.FindById("bidding", tmpid)
|
|
|
|
- if len(data) == 0 || data == nil {
|
|
|
|
- log.Debug("异常")
|
|
|
|
- }
|
|
|
|
- ul.BidMgo.Save("zktest_sample_data_source_3", data)
|
|
|
|
- //ul.BidMgo.Save("zktest_sample_data_source_2", data)
|
|
|
|
- }(v)
|
|
|
|
- }
|
|
|
|
- wg_mgo.Wait()
|
|
|
|
- log.Debug("is over ...")
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
// 测试调试数据
|
|
// 测试调试数据
|
|
-func test1() {
|
|
|
|
- q, total := map[string]interface{}{
|
|
|
|
- "_id": map[string]interface{}{
|
|
|
|
- "$gt": ul.StringTOBsonId("677638b13309c0998ba2488f"),
|
|
|
|
- "$lte": ul.StringTOBsonId("6777a3d23309c0998ba89797"),
|
|
|
|
- },
|
|
|
|
- }, 0
|
|
|
|
- count, _ := ul.BidMgo.Count("bidding", q)
|
|
|
|
- log.Debug("查询数量:", count)
|
|
|
|
-
|
|
|
|
- pool_mgo := make(chan bool, 10)
|
|
|
|
- wg_mgo := &sync.WaitGroup{}
|
|
|
|
-
|
|
|
|
- sess := ul.BidMgo.GetMgoConn()
|
|
|
|
- defer ul.BidMgo.DestoryMongoConn(sess)
|
|
|
|
-
|
|
|
|
- it := sess.DB(ul.BidMgo.DbName).C(ul.Bid_Name).Find(&q).Iter()
|
|
|
|
- for tmp := make(map[string]interface{}); it.Next(&tmp); total++ {
|
|
|
|
- if total%1000 == 0 {
|
|
|
|
- log.Debug("cur ai index ", total)
|
|
|
|
- }
|
|
|
|
- pool_mgo <- true
|
|
|
|
- wg_mgo.Add(1)
|
|
|
|
- go func(tmp map[string]interface{}) {
|
|
|
|
- defer func() {
|
|
|
|
- <-pool_mgo
|
|
|
|
- wg_mgo.Done()
|
|
|
|
- }()
|
|
|
|
- //tmpid := ul.BsonTOStringId(tmp["_id"])
|
|
|
|
- s1, s2 := gconv.String(tmp["budget"]), gconv.String(tmp["bidamount"])
|
|
|
|
- r1, r2 := strings.Split(s1, "."), strings.Split(s2, ".")
|
|
|
|
- if len(r1) == 2 {
|
|
|
|
- l1 := utf8.RuneCountInString(r1[1])
|
|
|
|
- if l1 > 3 {
|
|
|
|
- //log.Debug("问题金额:", tmpid, "~", s1)
|
|
|
|
- ul.BidMgo.Save("zktest_err_0106", tmp)
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if len(r2) == 2 {
|
|
|
|
- l2 := utf8.RuneCountInString(r2[1])
|
|
|
|
- if l2 > 3 {
|
|
|
|
- //log.Debug("问题金额:", tmpid, "~", s2)
|
|
|
|
- ul.BidMgo.Save("zktest_err_0106", tmp)
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }(tmp)
|
|
|
|
- tmp = make(map[string]interface{})
|
|
|
|
- }
|
|
|
|
- wg_mgo.Wait()
|
|
|
|
- log.Debug("is over ...", total)
|
|
|
|
-
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
func c(s string) string {
|
|
func c(s string) string {
|
|
s = strings.ReplaceAll(s, "(", "(")
|
|
s = strings.ReplaceAll(s, "(", "(")
|
|
s = strings.ReplaceAll(s, ")", ")")
|
|
s = strings.ReplaceAll(s, ")", ")")
|