sensitive

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2023 License: GPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SensitiveMap

type SensitiveMap struct {
	// contains filtered or unexported fields
}

ref:https://github.com/TomatoMr/SensitiveWords

func Singleton

func Singleton() *SensitiveMap

func (*SensitiveMap) CheckSensitive

func (s *SensitiveMap) CheckSensitive(text string) (string, bool)

检查是否含有敏感词,仅返回检查到的第一个敏感词,返回值:敏感词,是否含有敏感词

func (*SensitiveMap) FindAllSensitive

func (s *SensitiveMap) FindAllSensitive(text string) map[string]*Target

func (*SensitiveMap) ReplaceAll

func (s *SensitiveMap) ReplaceAll(text string, replacement string) string

type Target

type Target struct {
	Indexes []int
	Len     int
}

返回文本中的所有敏感词 返回值:数组,格式为“["敏感词"][敏感词在检测文本中的索引位置,敏感词长度]”

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL