JSPM

node-sensitive-word-filtering

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

A Node.js library for filtering sensitive words using a prefix tree (Trie).

Package Exports

  • node-sensitive-word-filtering
  • node-sensitive-word-filtering/sensitive-word-trie.js

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 (node-sensitive-word-filtering) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

node-sensitive-word-filtering

基于 node 实现的敏感词过滤脚本(前缀树)

示例使用

const trie = new Trie();
trie.insert('敏感词1');
trie.insert('敏感词12');

const inputText = '这里包含敏感词1和其他内容。';
const filteredText = trie.filter(inputText);

console.log(filteredText); // 输出: 这里包含****和其他内容。

const inputText2 = '灵敏';
const filteredText2 = trie.filter(inputText2);
console.log(inputText2); // 输出: 灵敏