SVG绘图转换
矢量图生成与PNG转
glin-profanity 是一款开源的内容审核库,用于检测和过滤用户生成内容中的不当言论。该库可识别多种规避手段,包括 leetspeak 变形(如 f4ck、sh1t)、Unicode 同形字符(如西里尔字母伪装)以及混淆文本,支持 24 种语言的检测。
安装指令
# JavaScript/TypeScript
npm install glin-profanity
# Python
pip install glin-profanity
基础用法(JavaScript/TypeScript)
import { checkProfanity, Filter } from 'glin-profanity';
// 简单检测
const result = checkProfanity("Your text here", {
detectLeetspeak: true,
normalizeUnicode: true,
languages: ['english']
});
result.containsProfanity // boolean
result.profaneWords // 检测到的词数组
result.processedText // 脱敏版本
// 使用 Filter 实例
const filter = new Filter({
replaceWith: '***',
detectLeetspeak: true,
normalizeUnicode: true
});
filter.isProfane("text") // boolean
filter.checkProfanity("text") // 完整结果对象
Python 用法
from glin_profanity import Filter
filter = Filter({
"languages": ["english"],
"replace_with": "***",
"detect_leetspeak": True
})
filter.is_profane("text") # True/False
filter.check_profanity("text") # 完整结果字典
React Hook 用法
import { useProfanityChecker } from 'glin-profanity';
function ChatInput() {
const { result, checkText } = useProfanityChecker({
detectLeetspeak: true
});
return (
<input onChange={(e) => checkText(e.target.value)} />
);
}
批量处理
import { batchCheck } from 'glin-profanity';
const results = batchCheck([
"Comment 1",
"Comment 2",
"Comment 3"
], { returnOnlyFlagged: true });
上下文感知分析
import { analyzeContext } from 'glin-profanity';
const result = analyzeContext("The patient has a breast tumor", {
domain: 'medical', // medical | gaming | technical | educational
contextWindow: 3,
confidenceThreshold: 0.7
});
见下方输入与输出表格。
| 项目 | 内容 |
|---|---|
| 输入 | 待检测文本;配置选项(语言、leetspeak级别、Unicode归一化、替换字符、自定义词库、忽略词库);上下文参数(领域、置信度阈值) |
| 输出 | 布尔检测结果;详细对象(是否含脏话、匹配词列表、脱敏后文本);批量结果数组;上下文分析评分 |
| 适用人群 | Web开发者、平台运营人员、社区管理员、需要集成内容审核功能的应用团队 |
| 不包含 | 图像/视频/音频审核;完全离线的ML模型;法律层面的最终内容裁定权 |
原始链接:https://github.com/openclaw/skills/tree/main/skills/thegdsks/glin-profanity/SKILL.md
来源类型:GitHub 仓库