main.go 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. package main
  2. import (
  3. "data_ai/clean"
  4. "data_ai/extract"
  5. "data_ai/udp"
  6. "data_ai/ul"
  7. log "github.com/donnie4w/go-logger/logger"
  8. qu "jygit.jydev.jianyu360.cn/data_processing/common_utils"
  9. "sync"
  10. "unicode/utf8"
  11. )
  12. func init() {
  13. ul.IsTool = false //是否工具
  14. ul.IsLocal = true //是否本地
  15. ul.IsFull = false //是否全量
  16. if ul.IsTool {
  17. ul.InitToolVar()
  18. } else {
  19. ul.InitGlobalVar()
  20. if !ul.IsFull {
  21. udp.InitProcessVar()
  22. }
  23. }
  24. ul.InitOss(ul.IsLocal)
  25. }
  26. func main() {
  27. if ul.IsTool {
  28. //tool.StartToolUpdateInfo()
  29. return
  30. }
  31. //extract.TestSingleFieldInfo("bidding", "6722de29b25c3e1debe624c9")
  32. test1()
  33. lock := make(chan bool)
  34. <-lock
  35. }
  36. func test() {
  37. log.Debug("开始大模型验证内存数据···")
  38. q := map[string]interface{}{}
  39. pool_mgo := make(chan bool, 500)
  40. wg_mgo := &sync.WaitGroup{}
  41. sess := ul.SourceMgo.GetMgoConn()
  42. defer ul.SourceMgo.DestoryMongoConn(sess)
  43. total, isok := 0, 0
  44. it := sess.DB(ul.SourceMgo.DbName).C(ul.Bid_Name).Find(&q).Sort("-_id").Iter()
  45. for tmp := make(map[string]interface{}); it.Next(&tmp); total++ {
  46. if total%1000 == 0 {
  47. log.Debug("cur index ", total)
  48. }
  49. isok++
  50. pool_mgo <- true
  51. wg_mgo.Add(1)
  52. go func(tmp map[string]interface{}) {
  53. defer func() {
  54. <-pool_mgo
  55. wg_mgo.Done()
  56. }()
  57. detail := qu.ObjToString(tmp["detail"])
  58. if utf8.RuneCountInString(detail) < 100 {
  59. data := extract.ResolveInfo(tmp)
  60. if len(data) > 0 {
  61. tmp["ai_zhipu"] = data
  62. ul.SourceMgo.Save("zktest_1031", tmp)
  63. }
  64. }
  65. }(tmp)
  66. tmp = make(map[string]interface{})
  67. }
  68. wg_mgo.Wait()
  69. log.Debug("ai is over ...")
  70. }
  71. func test1() {
  72. arr := []string{
  73. "下浮率:0.44%",
  74. "下浮率:0.60%",
  75. "下浮率:1.00%!",
  76. "下浮率:0.39!",
  77. "上浮率/下浮率:25%!",
  78. "下浮率:1.500%!",
  79. "上浮率/下浮率:25%!",
  80. "下浮率:20%",
  81. "下浮率:10%",
  82. "下浮率:10%",
  83. "下浮率:2.5!",
  84. "下浮率:1.00%!",
  85. "下浮率:0.39!",
  86. "下浮率:0.44%",
  87. "下浮率:6%!",
  88. "下浮率:10%-30%!",
  89. "下浮率:10%-25%",
  90. "下浮率:15%-20%",
  91. "下浮率:0.09%",
  92. "下浮率:5.5!",
  93. "下浮率:4.20%",
  94. "下浮率:1.50%!",
  95. "下浮率:12%!",
  96. "上浮率/下浮率:0.60%!",
  97. "下浮率:XX%",
  98. "下浮率:5.9%",
  99. "下浮率:40%",
  100. }
  101. for _, v := range arr {
  102. nv := clean.CleanDiscount(v)
  103. log.Debug(v, "~~~", nv)
  104. }
  105. }