ngl_server 1.0
基于 Actor 模型的 C++ 服务器框架
tools_filterword.cpp File Reference

实现聊天敏感词过滤和UTF-8输入验证 More...

#include "tools/tools/tools_filterword.h"
#include "tools/tools/tools_enum.h"
#include <array>
#include <limits>

Namespaces

namespace  ngl::tools
 工具函数命名空间。

Functions

void ngl::tools::test_filterword ()
 敏感词过滤功能测试函数

Detailed Description

实现聊天敏感词过滤和UTF-8输入验证

基于Aho-Corasick自动机算法实现高效的多模式字符串匹配:

  1. 敏感词加载与Trie树构建(load/build)
  2. 文本过滤与匹配检测(filter/match/is_filter)
  3. UTF-8/UTF-32编码转换验证
  4. Emoji和特殊字符检测与过滤
  5. 角色名合法性检查(check_name)
Note
Trie基于UTF-8字节构建,支持中文、日文、韩文等多语言敏感词
See also
tools_filterword.h