返回顶部
g

glin-profanity脏话检测库

Profanity detection and content moderation library with leetspeak, Unicode homoglyph, and ML-powered detection. Use when filtering user-generated content, moderating comments, checking text for profanity, censoring messages, or building content moderation into applications. Supports 24 languages.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
1,767
下载量
免费
免费
1
收藏
概述
安装方式
版本历史

glin-profanity

Glin Profanity - 内容审核库

可检测规避尝试的脏话检测库,如Leetspeak(f4ck、sh1t)、Unicode技巧(西里尔字母形近字)和混淆文本。

安装

bash

JavaScript/TypeScript


npm install glin-profanity

Python

pip install glin-profanity

快速使用

JavaScript/TypeScript

javascript
import { checkProfanity, Filter } from glin-profanity;

// 简单检查
const result = checkProfanity(您的文本内容, {
detectLeetspeak: true,
normalizeUnicode: true,
languages: [english]
});

result.containsProfanity // 布尔值
result.profaneWords // 检测到的脏话数组
result.processedText // 审查后的版本

// 使用Filter实例
const filter = new Filter({
replaceWith: *,
detectLeetspeak: true,
normalizeUnicode: true
});

filter.isProfane(文本) // 布尔值
filter.checkProfanity(文本) // 完整结果对象

Python

python
from glin_profanity import Filter

filter = Filter({
languages: [english],
replace_with: *,
detect_leetspeak: True
})

filter.is_profane(文本) # True/False
filter.check_profanity(文本) # 完整结果字典

React Hook

tsx
import { useProfanityChecker } from glin-profanity;

function ChatInput() {
const { result, checkText } = useProfanityChecker({
detectLeetspeak: true
});

return (
checkText(e.target.value)} />
);
}

主要特性

特性描述
Leetspeak检测f4ck、sh1t、@$$ 等模式
Unicode标准化
西里尔字母 fսck → fuck | | 24种语言 | 包括阿拉伯语、中文、俄语、印地语 | | 上下文白名单 | 医疗、游戏、技术领域 | | 机器学习集成 | 可选的TensorFlow.js毒性检测 | | 结果缓存 | LRU缓存提升性能 |

配置选项

javascript
const filter = new Filter({
languages: [english, spanish], // 要检查的语言
detectLeetspeak: true, // 捕获 f4ck、sh1t
leetspeakLevel: moderate, // basic | moderate | aggressive
normalizeUnicode: true, // 捕获Unicode技巧
replaceWith: *, // 替换字符
preserveFirstLetter: false, // f vs *
customWords: [badword], // 添加自定义词汇
ignoreWords: [hell], // 白名单词汇
cacheSize: 1000 // LRU缓存条目数
});

上下文感知分析

javascript
import { analyzeContext } from glin-profanity;

const result = analyzeContext(患者患有乳腺肿瘤, {
domain: medical, // medical | gaming | technical | educational
contextWindow: 3, // 匹配词周围的上下文窗口
confidenceThreshold: 0.7 // 标记的最低置信度
});

批量处理

javascript
import { batchCheck } from glin-profanity;

const results = batchCheck([
评论1,
评论2,
评论3
], { returnOnlyFlagged: true });

机器学习驱动检测(可选)

javascript
import { loadToxicityModel, checkToxicity } from glin-profanity/ml;

await loadToxicityModel({ threshold: 0.9 });

const result = await checkToxicity(你太差劲了);
// { toxic: true, categories: { toxicity: 0.92, insult: 0.87 } }

常见模式

聊天/评论审核

javascript const filter = new Filter({ detectLeetspeak: true, normalizeUnicode: true, languages: [english] });

bot.on(message, (msg) => {
if (filter.isProfane(msg.text)) {
deleteMessage(msg);
warnUser(msg.author);
}
});

发布前内容验证

javascript const result = filter.checkProfanity(userContent);

if (result.containsProfanity) {
return {
valid: false,
issues: result.profaneWords,
suggestion: result.processedText // 审查后的版本
};
}

资源

  • - 文档:https://www.typeweaver.com/docs/glin-profanity
  • 演示:https://www.glincker.com/tools/glin-profanity
  • GitHub:https://github.com/GLINCKER/glin-profanity
  • npm:https://www.npmjs.com/package/glin-profanity
  • PyPI:https://pypi.org/project/glin-profanity/

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 glin-profanity-1776374311 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 glin-profanity-1776374311 技能

通过命令行安装

skillhub install glin-profanity-1776374311

下载

⬇ 下载 glin-profanity v1.0.0(免费)

文件大小: 2.44 KB | 发布时间: 2026-4-17 13:48

v1.0.0 最新 2026-4-17 13:48
Initial release: Profanity detection library with leetspeak, Unicode homoglyph, and ML support. 24 languages.

Archiver·手机版·闲社网·闲社论坛·智能体自动化市场· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2026 闲社网·AI智能体论坛·AI自动化解决方案·http://xianshe.com

p2p_official_large
返回顶部