init.go 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585
  1. package main
  2. import (
  3. "log"
  4. "math"
  5. mu "mfw/util"
  6. "qfw/util"
  7. "reflect"
  8. "regexp"
  9. "sort"
  10. "strings"
  11. "sync"
  12. "go.mongodb.org/mongo-driver/bson/primitive"
  13. )
  14. var (
  15. Sysconfig map[string]interface{} //读取配置文件
  16. MongoTool, MgoBidding, MgoSpider *MongodbSim //mongodb连接
  17. ExtractColl, ProjectColl, BackupColl, SiteColl string //抽取表、项目表、项目快照表、站点表
  18. ExtractColl1 string
  19. Thread int //配置项线程数
  20. BlackList []interface{}
  21. BlaskListMap map[string]bool
  22. )
  23. var (
  24. //判断是日期
  25. _datereg = regexp.MustCompile("20[0-2][0-9][年-][0-9]{1,2}[月-][0-9]{1,2}[日-]([0-9]{1,2}时[0-9]{0,2})?")
  26. _numreg1 = regexp.MustCompile("^[0-9-]{1,8}$")
  27. _zimureg1 = regexp.MustCompile("^[a-zA-Z-]{1,7}$")
  28. _nzreg = regexp.MustCompile("^[0-9a-zA-Z-]+$")
  29. _hanreg = regexp.MustCompile(`^[\p{Han}::【】\\[\\]()()--、]+$`)
  30. replaceStr = regexp.MustCompile("(工程|采购|项目|[?!、【】()—()--]|栏标价|中标候选人|招标代理)")
  31. //判断带有分包、等特定词的
  32. pStr = regexp.MustCompile("(勘察|监理|施工|设计|验收|标段|分包|子包|[0-9A-Z]包|[一二三四五六七八九十0-9]批)")
  33. //判断包含数值
  34. nreg1 = regexp.MustCompile("[0-9]{2,}")
  35. //判断包含字母
  36. zreg1 = regexp.MustCompile("[a-zA-Z]{1,}")
  37. //判断包含汉字
  38. hreg1 = regexp.MustCompile(`[\p{Han}]+`)
  39. //判断项目编号是在10以内的纯数字结构
  40. numCheckPc = regexp.MustCompile("^[0-9-]{1,10}$")
  41. //仅初始化使用
  42. compareNoPass = map[string]bool{}
  43. compareAB = map[string]bool{}
  44. compareAB2D = map[string]bool{}
  45. compareABD = map[string]bool{}
  46. compareAB2CD = map[string]bool{}
  47. compareABCD = map[string]bool{}
  48. )
  49. func init() {
  50. util.ReadConfig(&Sysconfig)
  51. MongoTool = &MongodbSim{
  52. MongodbAddr: Sysconfig["mongodbServers"].(string),
  53. Size: util.IntAll(Sysconfig["mongodbPoolSize"]),
  54. DbName: Sysconfig["mongodbName"].(string),
  55. //UserName: "root",
  56. //Password: "root",
  57. }
  58. MongoTool.InitPool()
  59. bidding, _ := Sysconfig["bidding"].(map[string]interface{})
  60. MgoBidding = &MongodbSim{
  61. MongodbAddr: bidding["addr"].(string),
  62. Size: util.IntAll(bidding["dbsize"]),
  63. DbName: bidding["dbname"].(string),
  64. UserName: bidding["uname"].(string),
  65. Password: bidding["upwd"].(string),
  66. }
  67. MgoBidding.InitPool()
  68. spider, _ := Sysconfig["spider"].(map[string]interface{})
  69. MgoSpider = &MongodbSim{
  70. MongodbAddr: spider["addr"].(string),
  71. Size: util.IntAll(spider["dbsize"]),
  72. DbName: spider["dbname"].(string),
  73. }
  74. MgoSpider.InitPool()
  75. ExtractColl = Sysconfig["extractColl"].(string)
  76. ExtractColl1 = Sysconfig["extractColl1"].(string)
  77. ProjectColl = Sysconfig["projectColl"].(string)
  78. BackupColl = Sysconfig["projectColl"].(string) + "_back"
  79. SiteColl = Sysconfig["siteColl"].(string)
  80. Thread = util.IntAll(Sysconfig["thread"])
  81. //NextNode = Sysconfig["nextNode"].([]interface{})
  82. udpport, _ := Sysconfig["udpport"].(string)
  83. udpclient = mu.UdpClient{Local: udpport, BufSize: 1024}
  84. udpclient.Listen(processUdpMsg)
  85. log.Println("Udp服务监听", udpport)
  86. BlackList = Sysconfig["rp_blacklist"].([]interface{})
  87. BlaskListMap = make(map[string]bool)
  88. for _, v := range BlackList {
  89. BlaskListMap[util.ObjToString(v)] = true
  90. }
  91. initWinnerRegexp()
  92. initBuyerRegexp()
  93. initAgencyRegexp()
  94. //加载项目数据
  95. //---不能通过
  96. vm := []string{"C", "D"}
  97. for i := 0; i < 2; i++ {
  98. for j := 0; j < 2; j++ {
  99. for k := 0; k < 2; k++ {
  100. key := vm[i] + vm[j] + vm[k]
  101. compareNoPass[key] = true
  102. //fmt.Println(key)
  103. }
  104. }
  105. }
  106. //fmt.Println("-------------------")
  107. //三个元素一致 [AB][AB][AB],分值最高
  108. vm = []string{"A", "B"}
  109. for i := 0; i < 2; i++ {
  110. for j := 0; j < 2; j++ {
  111. for k := 0; k < 2; k++ {
  112. key := vm[i] + vm[j] + vm[k]
  113. compareAB[key] = true
  114. //fmt.Println(key)
  115. }
  116. }
  117. }
  118. //fmt.Println("-------------------", len(compareAB))
  119. //---至少两个一致,其他可能不存在
  120. //[AB][AB][ABD]
  121. //[AB][ABD][AB]
  122. vm = []string{"A", "B"}
  123. vm2 := []string{"A", "B", "D"}
  124. for i := 0; i < 2; i++ {
  125. for j := 0; j < 2; j++ {
  126. for k := 0; k < 3; k++ {
  127. key := vm[i] + vm[j] + vm2[k]
  128. if !compareAB[key] {
  129. compareAB2D[key] = true
  130. //fmt.Println(key)
  131. }
  132. }
  133. }
  134. }
  135. for i := 0; i < 2; i++ {
  136. for j := 0; j < 3; j++ {
  137. for k := 0; k < 2; k++ {
  138. key := vm[i] + vm2[j] + vm[k]
  139. if !compareAB[key] {
  140. compareAB2D[key] = true
  141. //fmt.Println(key)
  142. }
  143. }
  144. }
  145. }
  146. //fmt.Println("-------------------", len(compareAB2D))
  147. //---至少一个一致,其他可能不存在
  148. //[ABD][ABD][ABD] //已经删除DDD
  149. vm = []string{"A", "B", "D"}
  150. for i := 0; i < 3; i++ {
  151. for j := 0; j < 3; j++ {
  152. for k := 0; k < 3; k++ {
  153. key := vm[i] + vm[j] + vm[k]
  154. if !compareAB[key] && !compareAB2D[key] && !compareNoPass[key] {
  155. compareABD[key] = true
  156. //fmt.Println(key)
  157. }
  158. }
  159. }
  160. }
  161. //fmt.Println("-------------------", len(compareABD))
  162. //[AB][ABCD][AB]
  163. //[AB][AB][ABCD]
  164. vm = []string{"A", "B"}
  165. vm2 = []string{"A", "B", "C", "D"}
  166. for i := 0; i < 2; i++ {
  167. for j := 0; j < 4; j++ {
  168. for k := 0; k < 2; k++ {
  169. key := vm[i] + vm2[j] + vm[k]
  170. if !compareAB[key] && !compareAB2D[key] && !compareNoPass[key] && !compareABD[key] {
  171. compareAB2CD[key] = true
  172. //fmt.Println(key)
  173. }
  174. }
  175. }
  176. }
  177. for i := 0; i < 2; i++ {
  178. for j := 0; j < 2; j++ {
  179. for k := 0; k < 4; k++ {
  180. key := vm[i] + vm[j] + vm2[k]
  181. if !compareAB[key] && !compareAB2D[key] && !compareNoPass[key] && !compareABD[key] {
  182. compareAB2CD[key] = true
  183. //fmt.Println(key)
  184. }
  185. }
  186. }
  187. }
  188. //fmt.Println("-------------------", len(compareAB2CD))
  189. //[ABECD][ABECD][ABECD] //已经删除[CD][CD][CD] //这个要重点讨论
  190. vm = []string{"A", "B", "C", "D"}
  191. for i := 0; i < 4; i++ {
  192. for j := 0; j < 4; j++ {
  193. for k := 0; k < 4; k++ {
  194. key := vm[i] + vm[j] + vm[k]
  195. if !compareAB[key] && !compareAB2D[key] && !compareABD[key] && !compareNoPass[key] && !compareAB2CD[key] {
  196. compareABCD[key] = true
  197. //fmt.Println(key)
  198. }
  199. }
  200. }
  201. }
  202. }
  203. func CheckHanAndNum(str string) (b bool) {
  204. return nreg1.MatchString(str) && hreg1.MatchString(str)
  205. }
  206. func CheckZimuAndNum(str string) (b bool) {
  207. return zreg1.MatchString(str) && nreg1.MatchString(str)
  208. }
  209. type KeyMap struct {
  210. Lock sync.Mutex
  211. Map map[string]*Key
  212. }
  213. type ID struct {
  214. Id string
  215. Lock sync.Mutex
  216. P *ProjectInfo
  217. }
  218. type Key struct {
  219. Arr []string
  220. Lock sync.Mutex
  221. }
  222. type IdAndLock struct {
  223. Id string
  224. Lock sync.Mutex
  225. }
  226. func NewKeyMap() *KeyMap {
  227. return &KeyMap{
  228. Map: map[string]*Key{},
  229. Lock: sync.Mutex{},
  230. }
  231. }
  232. //招标信息实体类
  233. type Info struct {
  234. Id string `json:"_id"`
  235. Href string `json:"href"` //源地址
  236. Publishtime int64 `json:"publishtime"`
  237. Comeintime int64 `json:"comeintime"`
  238. Title string `json:"title"`
  239. TopType string `json:"toptype"`
  240. SubType string `json:"subtype"`
  241. ProjectName string `json:"projectname"`
  242. ProjectCode string `json:"projectcode"`
  243. ProjectScope string `json:"projectscope"`
  244. ContractCode string `json:"contractcode"`
  245. Buyer string `json:"buyer"`
  246. Buyerperson string `json:"buyerperson"`
  247. Buyertel string `json:"buyertel"`
  248. Agency string `json:"agency"`
  249. Area string `json:"area"`
  250. City string `json:"city"`
  251. District string `json:"district"`
  252. Infoformat int `json:"infoformat"`
  253. ReviewExperts []string `json:"review_experts"`
  254. Purchasing string `json:"purchasing"`
  255. WinnerOrder []map[string]interface{} `json:"winnerorder"`
  256. ProjectScale string `json:"project_scale"`
  257. ProjectDuration int `json:"project_duration"`
  258. ProjectTimeUnit string `json:"project_timeunit"`
  259. ProjectStartDate int64 `json:"project_startdate"`
  260. ProjectCompleteDate int64 `json:"project_completedate"`
  261. Payway string `json:"payway"`
  262. ContractGuarantee bool `json:"contract_guarantee"`
  263. BidGuarantee bool `json:"bid_guarantee"`
  264. Qualifies []map[string]interface{} `json:"qualifies"`
  265. EntIdList []string `json:"entidlist"`
  266. HasPackage bool // `json:"haspackage"`
  267. Package map[string]interface{} `json:"package"`
  268. Topscopeclass []string `json:"topscopeclass"`
  269. Subscopeclass []string `json:"subscopeclass"`
  270. Buyerclass string `json:"buyerclass"`
  271. Bidopentime int64 `json:"bidopentime"`
  272. Budget float64 `json:"budget"`
  273. Bidamount float64 `json:"bidamount"`
  274. Winners []string
  275. dealtype int
  276. PTC string //从标题中抽的项目编号
  277. pnbval int //项目名称、编号、采购单位存在的个数
  278. LenPC int //项目编号长度
  279. LenPN int //项目名称长度
  280. LenPTC int //标题抽的项目编号长度
  281. //以下三个元素做对比,计算包含时候使用
  282. PNBH int //0初始,+包含,-被包含
  283. PCBH int
  284. PTCBH int
  285. }
  286. //项目实体类
  287. type ProjectInfo struct {
  288. Id primitive.ObjectID `json:"_id"`
  289. FirstTime int64 `json:"firsttime,omitempty"` //项目的最早时间
  290. LastTime int64 `json:"lasttime,omitempty"` //项目的最后时间
  291. Ids []string `json:"ids,omitempty"`
  292. Topscopeclass []string `json:"topscopeclass,omitempty"`
  293. Subscopeclass []string `json:"subscopeclass,omitempty"` //子行业分类
  294. Winners []string `json:"s_winner,omitempty"` //中标人
  295. ProjectName string `json:"projectname,omitempty"` //项目名称
  296. ProjectCode string `json:"projectcode,omitempty"` //项目代码唯一(纯数字的权重低)
  297. ContractCode string `json:"contractcode,omitempty"` //项目编号
  298. Buyer string `json:"buyer,omitempty"` //采购单位唯一
  299. MPN []string `json:"mpn,omitempty"` //合并后多余的项目名称
  300. MPC []string `json:"mpc,omitempty"` //合并后多余的项目编号
  301. Buyerperson string `json:"buyerperson"` //采购联系人
  302. Buyertel string `json:"buyertel"` //采购联系人电话
  303. Agency string `json:"agency"` //代理机构
  304. Area string `json:"area"` //地区
  305. City string `json:"city"` //地市
  306. District string `json:"district"` //区县
  307. Bidstatus string `json:"bidstatus"` //
  308. Bidtype string `json:"bidtype"` //
  309. ReviewExperts []string `json:"review_experts"` // 项目评审专家
  310. Purchasing string `json:"purchasing"` // 标的物
  311. Package map[string]interface{} `json:"package,omitempty"` //分包的对比对象
  312. Buyerclass string `json:"buyerclass"` //采购单位分类
  313. Bidopentime int64 `json:"bidopentime,omitempty"` //开标时间
  314. Jgtime int64 `json:"jgtime"` //结果中标时间
  315. Zbtime int64 `json:"zbtime"` //招标时间
  316. Bidamount float64 `json:"bidamount,omitempty"` //中标金额
  317. Budget float64 `json:"budget,omitempty"` //预算
  318. Winnerorder []string `json:"winnerorder"` //中标候选人
  319. ProjectScale string `json:"project_scale"` //项目规模
  320. ProjectDuration int `json:"project_duration"` //工期时长
  321. ProjectTimeunit string `json:"project_timeunit"` //工期时长单位
  322. ProjectStartDate int64 `json:"project_startdate"` //开工日期
  323. ProjctCompleteDate int64 `json:"projct_completedate"` //竣工日期
  324. Payway string `json:"payway"` //付款方式
  325. ContractGuarantee bool `json:"contract_guarantee"` //履约保证金 是否支持包含
  326. BidGuarantee bool `json:"bid_guarantee"` //投标保证金 是否支持包含
  327. Qualifies string `json:"qualifies"` //资质条件
  328. EntIdList []string `json:"entidlist"` //企业id
  329. score int
  330. comStr string
  331. resVal, pjVal int
  332. InfoFiled map[string]InfoField `json:"infofield"` //逻辑处理需要的info字段
  333. Budgettag int `json:"budgettag"` //预算是否有效标记
  334. Bidamounttag int `json:"bidamounttag"` //中标金额是否有效标记
  335. }
  336. //存储部分招标信息字段,业务逻辑处理需要
  337. type InfoField struct {
  338. Budget float64 `json:"budget"`
  339. Bidamount float64 `json:"bidamount"`
  340. ContractCode string `json:"contractcode"`
  341. ProjectName string `json:"projectname"`
  342. ProjectCode string `json:"projectcode"`
  343. Bidstatus string `json:"bidstatus"`
  344. }
  345. //站点信息
  346. type Site struct {
  347. Id string `json:"_id"`
  348. Site string `json:"site"` //站点名字
  349. Area string `json:"area"` //省
  350. City string `json:"city"` //市
  351. District string `json:"district"` //区、县
  352. Domain string `json:"domain"` //地址
  353. Status int `json:"status"` //
  354. }
  355. //二分字符串查找
  356. func BinarySearch(s []string, k string) int {
  357. sort.Strings(s)
  358. lo, hi := 0, len(s)-1
  359. for lo <= hi {
  360. m := (lo + hi) >> 1
  361. if s[m] < k {
  362. lo = m + 1
  363. } else if s[m] > k {
  364. hi = m - 1
  365. } else {
  366. return m
  367. }
  368. }
  369. return -1
  370. }
  371. func Duplicate(a interface{}) (ret []interface{}) {
  372. va := reflect.ValueOf(a)
  373. for i := 0; i < va.Len(); i++ {
  374. if i > 0 && reflect.DeepEqual(va.Index(i-1).Interface(), va.Index(i).Interface()) {
  375. continue
  376. }
  377. ret = append(ret, va.Index(i).Interface())
  378. }
  379. return ret
  380. }
  381. //计算文本相似度
  382. func CosineSimilar(srcWords1, dstWords1 string) float64 {
  383. srcWords, dstWords := strings.Split(srcWords1, ""), strings.Split(dstWords1, "")
  384. // get all words
  385. allWordsMap := make(map[string]int, 0)
  386. for _, word := range srcWords {
  387. if _, found := allWordsMap[word]; !found {
  388. allWordsMap[word] = 1
  389. } else {
  390. allWordsMap[word] += 1
  391. }
  392. }
  393. for _, word := range dstWords {
  394. if _, found := allWordsMap[word]; !found {
  395. allWordsMap[word] = 1
  396. } else {
  397. allWordsMap[word] += 1
  398. }
  399. }
  400. // stable the sort
  401. allWordsSlice := make([]string, 0)
  402. for word, _ := range allWordsMap {
  403. allWordsSlice = append(allWordsSlice, word)
  404. }
  405. // assemble vector
  406. srcVector := make([]int, len(allWordsSlice))
  407. dstVector := make([]int, len(allWordsSlice))
  408. for _, word := range srcWords {
  409. if index := BinarySearch(allWordsSlice, word); index != -1 {
  410. srcVector[index] += 1
  411. }
  412. }
  413. for _, word := range dstWords {
  414. if index := BinarySearch(allWordsSlice, word); index != -1 {
  415. dstVector[index] += 1
  416. }
  417. }
  418. // calc cos
  419. numerator := float64(0)
  420. srcSq := 0
  421. dstSq := 0
  422. for i, srcCount := range srcVector {
  423. dstCount := dstVector[i]
  424. numerator += float64(srcCount * dstCount)
  425. srcSq += srcCount * srcCount
  426. dstSq += dstCount * dstCount
  427. }
  428. denominator := math.Sqrt(float64(srcSq * dstSq))
  429. v1 := numerator / denominator
  430. // if v1 > 0.6 {
  431. // log.Println(v1, srcWords1, dstWords1)
  432. // }
  433. return v1
  434. }
  435. func initWinnerRegexp() {
  436. winRegMap := Sysconfig["winner"].(map[string]interface{})
  437. //preRegexps := winRegMap["pre_regexp"].([]interface{})
  438. //backRegexps := winRegMap["back_regexp"].([]interface{})
  439. //backRepRegexps := winRegMap["back_rep_regexp"].([]interface{})
  440. backBlack := winRegMap["blacklist"].([]interface{})
  441. //var winPreRegexps []*regexp.Regexp
  442. //for _, v := range preRegexps {
  443. // reg := regexp.MustCompile("^" + v.(string))
  444. // winPreRegexps = append(winPreRegexps, reg)
  445. //}
  446. //PreRegexp["winner"] = winPreRegexps
  447. //var winBackRegexps []*regexp.Regexp
  448. //for _, v := range backRegexps {
  449. // reg := regexp.MustCompile(v.(string))
  450. // winBackRegexps = append(winBackRegexps, reg)
  451. //}
  452. //BackRegexp["winner"] = winBackRegexps
  453. //var winBackRepRegexps []RegexpInfo
  454. //for _, v := range backRepRegexps {
  455. // reps := strings.Split(v.(string), "#")
  456. // if len(reps) > 1 {
  457. // reg := RegexpInfo{
  458. // regs: regexp.MustCompile(reps[0]),
  459. // repstr: reps[1],
  460. // }
  461. // winBackRepRegexps = append(winBackRepRegexps, reg)
  462. // }
  463. //}
  464. //BackRepRegexp["winner"] = winBackRepRegexps
  465. var winBlackRegexps []*regexp.Regexp
  466. for _, v := range backBlack {
  467. reg := regexp.MustCompile(v.(string))
  468. winBlackRegexps = append(winBlackRegexps, reg)
  469. }
  470. BlackRegexp["winner"] = winBlackRegexps
  471. }
  472. func initBuyerRegexp() {
  473. buyRegMap := Sysconfig["buyer"].(map[string]interface{})
  474. //preRegexps := buyRegMap["pre_regexp"].([]interface{})
  475. //backRegexps := buyRegMap["back_regexp"].([]interface{})
  476. //backRepRegexps := buyRegMap["back_rep_regexp"].([]interface{})
  477. backBlack := buyRegMap["blacklist"].([]interface{})
  478. //var winPreRegexps []*regexp.Regexp
  479. //for _, v := range preRegexps {
  480. // reg := regexp.MustCompile("^" + v.(string))
  481. // winPreRegexps = append(winPreRegexps, reg)
  482. //}
  483. //PreRegexp["buyer"] = winPreRegexps
  484. //var winBackRegexps []*regexp.Regexp
  485. //for _, v := range backRegexps {
  486. // reg := regexp.MustCompile(v.(string))
  487. // winBackRegexps = append(winBackRegexps, reg)
  488. //}
  489. //BackRegexp["buyer"] = winBackRegexps
  490. //var winBackRepRegexps []RegexpInfo
  491. //for _, v := range backRepRegexps {
  492. // reps := strings.Split(v.(string), "#")
  493. // if len(reps) > 1 {
  494. // reg := RegexpInfo{
  495. // regs: regexp.MustCompile(reps[0]),
  496. // repstr: reps[1],
  497. // }
  498. // winBackRepRegexps = append(winBackRepRegexps, reg)
  499. // }
  500. //}
  501. //BackRepRegexp["buyer"] = winBackRepRegexps
  502. var winBlackRegexps []*regexp.Regexp
  503. for _, v := range backBlack {
  504. reg := regexp.MustCompile(v.(string))
  505. winBlackRegexps = append(winBlackRegexps, reg)
  506. }
  507. BlackRegexp["buyer"] = winBlackRegexps
  508. }
  509. func initAgencyRegexp() {
  510. buyRegMap := Sysconfig["agency"].(map[string]interface{})
  511. //preRegexps := buyRegMap["pre_regexp"].([]interface{})
  512. //backRegexps := buyRegMap["back_regexp"].([]interface{})
  513. //backRepRegexps := buyRegMap["back_rep_regexp"].([]interface{})
  514. backBlack := buyRegMap["blacklist"].([]interface{})
  515. //var winPreRegexps []*regexp.Regexp
  516. //for _, v := range preRegexps {
  517. // reg := regexp.MustCompile("^" + v.(string))
  518. // winPreRegexps = append(winPreRegexps, reg)
  519. //}
  520. //PreRegexp["agency"] = winPreRegexps
  521. //var winBackRegexps []*regexp.Regexp
  522. //for _, v := range backRegexps {
  523. // reg := regexp.MustCompile(v.(string))
  524. // winBackRegexps = append(winBackRegexps, reg)
  525. //}
  526. //BackRegexp["agency"] = winBackRegexps
  527. //var winBackRepRegexps []RegexpInfo
  528. //for _, v := range backRepRegexps {
  529. // reps := strings.Split(v.(string), "#")
  530. // if len(reps) > 1 {
  531. // reg := RegexpInfo{
  532. // regs: regexp.MustCompile(reps[0]),
  533. // repstr: reps[1],
  534. // }
  535. // winBackRepRegexps = append(winBackRepRegexps, reg)
  536. // }
  537. //}
  538. //BackRepRegexp["agency"] = winBackRepRegexps
  539. var winBlackRegexps []*regexp.Regexp
  540. for _, v := range backBlack {
  541. reg := regexp.MustCompile(v.(string))
  542. winBlackRegexps = append(winBlackRegexps, reg)
  543. }
  544. BlackRegexp["agency"] = winBlackRegexps
  545. }