Commit e8fe507a by zhaoyanchao

英文符号转中文,加屏蔽词

parent 388a7fe5
......@@ -5,7 +5,7 @@ import (
"github.com/mozillazg/go-pinyin"
"fmt"
"strconv"
)
)
type ENV struct {
DataWareDB string
......@@ -16,6 +16,7 @@ type ENV struct {
ManualFolder string
SensitiveFolder string
}
var test_env = &ENV{
DataWareDB: "DataWarehouse_test:FihdZW7o1XKtDETZexOG@tcp(test01-secooDataWarehouse.master.com:3306)/secooDataWarehouse",
ErpDB: "3306_test:iS6CXpYqgZ8Mhjui@tcp(10.4.3.223:3306)/secooErpDB",
......@@ -43,6 +44,22 @@ var RUN_ENV = prod_env
/************************* 下面是 util 方法 *****************************/
var CH_EN_PUNC = map[string]string {
",":",",
"。":".",
"!":"!",
"?":"?",
"【":"[",
"】":"]",
"(":"(",
")":")",
"‘":"'",
"’":"'",
"“":"\"",
"”":"\"",
}
func convertToPinyin(str string) string {
var ret string
for _, v := range str {
......@@ -78,12 +95,16 @@ func DBC2SBC(s string) string {
var strLst []string
for _, i := range s {
insideCode := i
if insideCode == 12288 {
insideCode = 32
} else {
insideCode -= 65248
}
if insideCode < 32 || insideCode > 126 {
if key,exist := CH_EN_PUNC[string(i)]; exist {
strLst = append(strLst, key)
} else if insideCode < 32 || insideCode > 126 {
strLst = append(strLst, string(i))
} else {
strLst = append(strLst, string(insideCode))
......
......@@ -66,7 +66,7 @@ var dateStr = fmt.Sprintf("%d-%02d-%02d",now.Year(),now.Month(),now.Day())
var t2s, _ = gocc.New("t2s")
var prefixFilterArr = []string{"https://", "http://", "dg", "d & g", "dolce&gabbana",
"dolce & gabbana", "杜嘉班纳", "避孕", "情趣", "cucci", "乒乓球", "cuccl", "gucii"}
"dolce & gabbana", "杜嘉班纳", "避孕", "情趣", "cucci", "乒乓球", "cuccl", "gucii","tod's","iwc7" }
const TABLE_SPLIT_STEP_SIZE = 10000
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment