All Projects → importcjj → Sensitive

importcjj / Sensitive

Licence: mit
敏感词查找,验证,过滤和替换 🤓 FindAll, Validate, Filter and Replace words.

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Sensitive

Lmdb Embeddings
Fast word vectors with little memory usage in Python
Stars: ✭ 404 (+38.36%)
Mutual labels:  word, text
Pesdk Android Demo
A fully customizable photo editor for your app.
Stars: ✭ 464 (+58.9%)
Mutual labels:  text, filter
Pesdk Ios Examples
A fully customizable photo editor for your app.
Stars: ✭ 837 (+186.64%)
Mutual labels:  text, filter
Ml Ai Experiments
All my experiments with AI and ML
Stars: ✭ 107 (-63.36%)
Mutual labels:  word, text
Flash
Golang Keyword extraction/replacement Datastructure using Tries instead of regexes
Stars: ✭ 79 (-72.95%)
Mutual labels:  trie, text
vesdk-android-demo
VideoEditor SDK: A fully customizable video editor for your app.
Stars: ✭ 90 (-69.18%)
Mutual labels:  text, filter
Completely
Java autocomplete library.
Stars: ✭ 90 (-69.18%)
Mutual labels:  trie, text
regXwild
⏱ Superfast ^Advanced wildcards++? | Unique algorithms that was implemented on native unmanaged C++ but easily accessible in .NET via Conari (with caching of 0x29 opcodes +optimizations) etc.
Stars: ✭ 20 (-93.15%)
Mutual labels:  text, filter
Graphql To Mongodb
Allows for generic run-time generation of filter types for existing graphql types and parsing client requests to mongodb find queries
Stars: ✭ 261 (-10.62%)
Mutual labels:  filter
Vuewordcloud
Generates a cloud out of the words.
Stars: ✭ 284 (-2.74%)
Mutual labels:  word
Blotter
A JavaScript API for drawing unconventional text effects on the web.
Stars: ✭ 2,833 (+870.21%)
Mutual labels:  text
Gridjs
Advanced table plugin
Stars: ✭ 3,231 (+1006.51%)
Mutual labels:  filter
Angular Filter
Bunch of useful filters for AngularJS (with no external dependencies!)
Stars: ✭ 2,962 (+914.38%)
Mutual labels:  filter
Jschema
A simple, easy to use data modeling framework for JavaScript
Stars: ✭ 261 (-10.62%)
Mutual labels:  filter
Grips
Simple-logic templates
Stars: ✭ 289 (-1.03%)
Mutual labels:  text
Muxie
Muxie is a modern, fast and light HTTP multiplexer for Go. Fully compatible with the http.Handler interface. Written for everyone.
Stars: ✭ 257 (-11.99%)
Mutual labels:  trie
GPUImage FilterVideo
录制美颜视频
Stars: ✭ 12 (-95.89%)
Mutual labels:  filter
Gradient Widgets
Flutter widgets wrapped with gradients
Stars: ✭ 290 (-0.68%)
Mutual labels:  text
React Spectrum
Generate colorful text placeholders 🎨
Stars: ✭ 289 (-1.03%)
Mutual labels:  text
A
A graphical text editor
Stars: ✭ 280 (-4.11%)
Mutual labels:  text

Sensitive

敏感词查找,验证,过滤和替换

FindAll, Validate, Filter and Replace words.

Build Status GoDoc

新增分支Aho-Corasick以支持AC自动机

用法

package main

import (
	"fmt"
	"github.com/importcjj/sensitive"
)

func main() {
	filter := sensitive.New()
	filter.LoadWordDict("path/to/dict")
	// Do something
}

AddWord

添加敏感词

filter.AddWord("垃圾")

Replace

把词语中的字符替换成指定的字符,这里的字符指的是rune字符,比如*就是'*'

filter.Replace("这篇文章真的好垃圾", '*')
// output => 这篇文章真的好**

Filter

直接移除词语

filter.Filter("这篇文章真的好垃圾啊")
// output => 这篇文章真的好啊

FindIn

查找并返回第一个敏感词,如果没有则返回false

filter.FindIn("这篇文章真的好垃圾")
// output => true, 垃圾

Validate

验证内容是否ok,如果含有敏感词,则返回false和第一个敏感词。

filter.Validate("这篇文章真的好垃圾")
// output => false, 垃圾

FindAll

查找内容中的全部敏感词,以数组返回。

filter.FindAll("这篇文章真的好垃圾")
// output => [垃圾]

LoadNetWordDict

加载网络词库。

filter.LoadNetWordDict("https://raw.githubusercontent.com/importcjj/sensitive/master/dict/dict.txt")

UpdateNoisePattern

设置噪音模式,排除噪音字符。

// failed
filter.FindIn("这篇文章真的好垃x圾")      // false
filter.UpdateNoisePattern(`x`)
// success
filter.FindIn("这篇文章真的好垃x圾")      // true, 垃圾
filter.Validate("这篇文章真的好垃x圾")    // False, 垃圾
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].