123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- package main
- import (
- "data_ai/clean"
- "data_ai/extract"
- "data_ai/udp"
- "data_ai/ul"
- log "github.com/donnie4w/go-logger/logger"
- qu "jygit.jydev.jianyu360.cn/data_processing/common_utils"
- "sync"
- "unicode/utf8"
- )
- func init() {
- ul.IsTool = false //是否工具
- ul.IsLocal = true //是否本地
- ul.IsFull = false //是否全量
- if ul.IsTool {
- ul.InitToolVar()
- } else {
- ul.InitGlobalVar()
- if !ul.IsFull {
- udp.InitProcessVar()
- }
- }
- ul.InitOss(ul.IsLocal)
- }
- func main() {
- if ul.IsTool {
- //tool.StartToolUpdateInfo()
- return
- }
- //extract.TestSingleFieldInfo("bidding", "6722de29b25c3e1debe624c9")
- test1()
- lock := make(chan bool)
- <-lock
- }
- func test() {
- log.Debug("开始大模型验证内存数据···")
- q := map[string]interface{}{}
- pool_mgo := make(chan bool, 500)
- wg_mgo := &sync.WaitGroup{}
- sess := ul.SourceMgo.GetMgoConn()
- defer ul.SourceMgo.DestoryMongoConn(sess)
- total, isok := 0, 0
- it := sess.DB(ul.SourceMgo.DbName).C(ul.Bid_Name).Find(&q).Sort("-_id").Iter()
- for tmp := make(map[string]interface{}); it.Next(&tmp); total++ {
- if total%1000 == 0 {
- log.Debug("cur index ", total)
- }
- isok++
- pool_mgo <- true
- wg_mgo.Add(1)
- go func(tmp map[string]interface{}) {
- defer func() {
- <-pool_mgo
- wg_mgo.Done()
- }()
- detail := qu.ObjToString(tmp["detail"])
- if utf8.RuneCountInString(detail) < 100 {
- data := extract.ResolveInfo(tmp)
- if len(data) > 0 {
- tmp["ai_zhipu"] = data
- ul.SourceMgo.Save("zktest_1031", tmp)
- }
- }
- }(tmp)
- tmp = make(map[string]interface{})
- }
- wg_mgo.Wait()
- log.Debug("ai is over ...")
- }
- func test1() {
- arr := []string{
- "下浮率:0.44%",
- "下浮率:0.60%",
- "下浮率:1.00%!",
- "下浮率:0.39!",
- "上浮率/下浮率:25%!",
- "下浮率:1.500%!",
- "上浮率/下浮率:25%!",
- "下浮率:20%",
- "下浮率:10%",
- "下浮率:10%",
- "下浮率:2.5!",
- "下浮率:1.00%!",
- "下浮率:0.39!",
- "下浮率:0.44%",
- "下浮率:6%!",
- "下浮率:10%-30%!",
- "下浮率:10%-25%",
- "下浮率:15%-20%",
- "下浮率:0.09%",
- "下浮率:5.5!",
- "下浮率:4.20%",
- "下浮率:1.50%!",
- "下浮率:12%!",
- "上浮率/下浮率:0.60%!",
- "下浮率:XX%",
- "下浮率:5.9%",
- "下浮率:40%",
- }
- for _, v := range arr {
- nv := clean.CleanDiscount(v)
- log.Debug(v, "~~~", nv)
- }
- }
|