init.go 20 KB

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