SensitiveWordContains 是否包含敏感词,返回是否包含敏感词和敏感词列表
(text string)
| 55 | |
| 56 | // SensitiveWordContains 是否包含敏感词,返回是否包含敏感词和敏感词列表 |
| 57 | func 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 敏感词替换,返回是否包含敏感词和替换后的文本 |
| 69 | func SensitiveWordReplace(text string, returnImmediately bool) (bool, []string, string) { |
no test coverage detected