Files
Jyotisha/frontend/src/lib/moderation/lexicon.ts
T

85 lines
2.9 KiB
TypeScript

import type { ModerationCategory } from "./types";
/**
* Local sensitive-content lexicon (2026-09-30, compliance round).
*
* Reviewable data, not logic. Rules match against normalized text (see
* `normalizeForModeration`: lower case, half-width, whitespace / punctuation /
* zero-width removed). Entries are deliberately multi-character phrases so the
* astrology vocabulary this product lives on — 死亡宫、第八宫、凶星、灾难、
* Maraka、罗睺、计都 — never trips them (see moderation tests). The list is a
* floor, not a filter of record: legal must review it before launch, and the
* remote provider (MODERATION_PROVIDER=aliyun) is the production judge.
*/
export type LexiconRule = Readonly<{
id: string;
category: Exclude<ModerationCategory, "remote">;
/** Plain phrases (matched as substrings of the normalized text). */
phrases?: readonly string[];
/** Patterns run on the normalized text. */
patterns?: readonly RegExp[];
}>;
export const MODERATION_LEXICON: readonly LexiconRule[] = [
{
id: "political.subversion",
category: "political",
phrases: ["颠覆国家政权", "推翻共产党", "推翻中共", "分裂国家", "煽动颠覆"],
},
{
id: "political.separatism",
category: "political",
phrases: ["台独", "藏独", "疆独", "港独", "东突厥斯坦"],
},
{
id: "political.banned-org",
category: "political",
phrases: ["法轮功", "法轮大法", "全能神"],
},
{
id: "extremism.weapons-howto",
category: "violent_extremism",
phrases: ["炸弹制作", "制作炸弹", "自制炸药", "炸药配方", "土制炸弹", "怎么做炸弹"],
},
{
id: "extremism.terror",
category: "violent_extremism",
phrases: ["恐怖袭击计划", "策划恐袭", "圣战招募", "加入isis", "加入伊斯兰国"],
},
{
id: "extremism.harm-others",
category: "violent_extremism",
phrases: ["怎么杀人不被发现", "如何杀人不被发现", "怎么投毒", "如何投毒"],
},
{
id: "sexual.minor",
category: "sexual_minor",
phrases: ["儿童色情", "幼女色情", "萝莉色情", "未成年色情", "恋童"],
},
{
id: "selfharm.method",
category: "self_harm",
phrases: ["自杀方法", "怎么自杀", "如何自杀", "怎样自杀", "怎么割腕", "吃多少安眠药会死", "无痛自杀"],
},
{
id: "selfharm.intent",
category: "self_harm",
phrases: ["我想自杀", "我要自杀", "我不想活了", "想结束自己的生命"],
},
{
id: "trade.drugs",
category: "illegal_trade",
phrases: ["买冰毒", "卖冰毒", "买海洛因", "买大麻", "代购毒品", "买k粉"],
},
{
id: "trade.weapons",
category: "illegal_trade",
phrases: ["买枪支", "卖枪支", "网购枪支", "仿真枪出售"],
},
{
id: "trade.documents",
category: "illegal_trade",
phrases: ["办假证", "代开发票", "买卖身份证", "出售银行卡"],
},
];