<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          go-wordsfilter高性能的 Go 敏感詞過(guò)濾器

          聯(lián)合創(chuàng)作 · 2023-09-30 20:20

          go-wordsfilter 是一個(gè)高性能的 Go 敏感詞過(guò)濾器,通過(guò)預(yù)先讀取敏感詞源并構(gòu)建樹(shù)狀結(jié)構(gòu)數(shù)據(jù)的方式來(lái)高效地檢測(cè)和替換敏感詞。采用 MIT 開(kāi)源協(xié)議。

          下載安裝

          go get github.com/syyongx/go-wordsfilter

          快速開(kāi)始

          import (
              "github.com/syyongx/go-wordsfilter"
          )
          
          func main() {
              texts := []string{
                  "Miyamoto Musashi",
                  "妲己",
                  "アンジェラ",
                  "?????????????",
              }
              wf := wordsfilter.New()
          
              // Generate
              root := wf.Generate(texts)
              // Generate with file
              // root := wf.GenerateWithFile(path)
          
              // Contains
              c1 := wf.Contains("アン", root)
              // c1: false
              c2 := wf.Contains("アンジェラ", root)
              // c2: true
          
              // Remove
              wf.Remove("アンジェラ", root)
              c3 := wf.Contains("アンジェラ", root)
              // c3: false
          
              // Replace
              r1 := wf.Replace("Game ????????????? i like 妲己 heroMiyamotoMusashi", root)
              // r1: Game*************ilike**hero***************
          }

          Apis

          New() *WordsFilter
          Generate(texts []string) map[string]*Node
          GenerateWithFile(path string) (map[string]*Node, error)
          Add(text string, root map[string]*Node)
          Replace(text string, root map[string]*Node) string
          Contains(text string, root map[string]*Node) bool
          Remove(text string, root map[string]*Node)
          瀏覽 19
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          評(píng)論
          圖片
          表情
          推薦
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  俺操也| 亚洲日本欧美视频 | 不卡不卡不卡不卡不卡国产精品视频 | 欧美国产操逼 | 久久成人三级电影 |