UNPKG

@zhin.js/sensitive-filter

Version:

敏感词过滤插件,过滤不符合中国国情的敏感内容

46 lines 1.52 kB
/** * 敏感词库 * 包含政治、暴力、色情、违禁品等敏感词汇 */ export declare const politicalWords: string[]; export declare const violenceWords: string[]; export declare const pornWords: string[]; export declare const prohibitedWords: string[]; export declare const fraudWords: string[]; export declare const illegalWords: string[]; export declare const homophoneWords: string[]; export declare const allSensitiveWords: string[]; /** * 创建敏感词正则表达式 */ export declare function createSensitiveWordRegex(words: string[]): RegExp; /** * 敏感词检测选项 */ export interface SensitiveFilterOptions { /** 是否启用政治敏感词过滤 */ political?: boolean; /** 是否启用暴力恐怖词汇过滤 */ violence?: boolean; /** 是否启用色情低俗词汇过滤 */ porn?: boolean; /** 是否启用违禁品词汇过滤 */ prohibited?: boolean; /** 是否启用诈骗相关词汇过滤 */ fraud?: boolean; /** 是否启用其他违法违规词汇过滤 */ illegal?: boolean; /** 是否启用谐音词、变体词过滤 */ homophone?: boolean; /** 自定义敏感词列表 */ custom?: string[]; /** 替换字符,默认为 * */ replacement?: string; /** 是否直接拦截包含敏感词的消息 */ block?: boolean; } /** * 获取启用的敏感词列表 */ export declare function getEnabledWords(options: SensitiveFilterOptions): string[]; //# sourceMappingURL=sensitive-words.d.ts.map