MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / SensitiveWordContains

Function SensitiveWordContains

service/sensitive.go:57–66  ·  view source on GitHub ↗

SensitiveWordContains 是否包含敏感词,返回是否包含敏感词和敏感词列表

(text string)

Source from the content-addressed store, hash-verified

55
56// SensitiveWordContains 是否包含敏感词,返回是否包含敏感词和敏感词列表
57func SensitiveWordContains(text string) (bool, []string) {
58 if len(setting.SensitiveWords) == 0 {
59 return false, nil
60 }
61 if len(text) == 0 {
62 return false, nil
63 }
64 checkText := strings.ToLower(text)
65 return AcSearch(checkText, setting.SensitiveWords, true)
66}
67
68// SensitiveWordReplace 敏感词替换,返回是否包含敏感词和替换后的文本
69func SensitiveWordReplace(text string, returnImmediately bool) (bool, []string, string) {

Callers 2

CheckSensitiveMessagesFunction · 0.85
CheckSensitiveTextFunction · 0.85

Calls 1

AcSearchFunction · 0.85

Tested by

no test coverage detected