JSPM

text-censor

1.0.2
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 6
    • Score
      100M100P100Q43520F
    • License MIT

    Censor politically-sensitive words in China. 国内敏感词过滤器。

    Package Exports

    • text-censor

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (text-censor) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    NPM Version

    Introduction

    A simple&basic text filter that is under censor of GFW, with DFA.

    为nodejs提供的简单GFW敏感词过滤器,使用DFA实现。

    Usage

    var tc = require('text-censor')
    tc.filter('Ur so sexy babe!',function(err, censored){
        console.log(censored) // 'Ur so ***y babe!'
    })

    If you want to add key words of your own, simply add them to the end of 'keywords' file, one word per line.

    在'keywords'文件末尾增加自定义敏感词,每行一个。

    Performance

    Under 1ms for a 10-20 words sentence. Around 10ms for 1000 words.

    10-20字的短句在1ms以内替换完成,1000字左右需要10ms左右

    Thanks

    Keyword list from https://github.com/observerss/textfilter

    License

    MIT