GithubHelp home page GithubHelp logo

go-sensitive's Introduction

go-sensitive

敏感词检测

Usage

package main

import (
    "fmt"
    "github.com/chenjinya/go-sensitive"
)

func main(){

    
    sensitive.Load("./words.txt")
    h,s := sensitive.Hit("热比垭亚")

    fmt.Println(h, s)
}

需要提前准备 words.txt 敏感词库

逻辑

使用多叉树模型

Benchmark

循环次数 50 多叉树 50 遍历 100 多叉树 100 遍历
循环次数 124059 123309 110617 58798
执行时间 10298 ns/op 9604 ns/op 9628 ns/op 19927 ns/op
占用内存 2480 B/op 0 B/op 2480 B/op 0 B/op
分配内存 12 allocs/op 0 allocs/op 12 allocs/op 0 allocs/op

在敏感词 大于 50 个的时候,多叉树模型比传统遍历性能有显著提升

go-sensitive's People

Contributors

chenjinya avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.