OpenAI's Privacy Filter gives common Chinese names (张伟, 李娜, 陈建国,
黄晓明) almost no PERSON weight. Lowering the O label's emission by 2 or
4 in a patched pf-serve didn't bring them back. It also returns spans
that run past the name (「王芳,她下周一」, 「张伟先生」).
zhname.go adds a rule layer behind the model, only when personal data
is covered:
- a surname (single, compound, or 小/老 + surname) with a 1–2
character given name is masked when something around it says it is
a person:
- a role before it (客户, 联系人:, 我叫, 作者:, @);
- a verb before it (给, 告诉, 抄送) or after it (说, 反馈, 先生);
- a title or 总 (孙经理, 邓总);
- a name joined by 和/与/跟/及/、 to a name already found counts too;
- words that start with a surname (张量, 高度, 王国, 周五, 总是) are
never taken;
- the model's PERSON spans with Han in them are cut at punctuation or a
title, and only when at least two characters remain.
Run:
- Real model, end to end through MaskJSON (pf-serve q8, Metal):
- masked 张伟, 王芳 (cut), 李娜, 刘洋, 陈建国, 赵丽颖, 欧阳娜娜, 司马光,
黄晓明, 周杰伦, 小王, 老李, 马云, 王老板, 邓总, 孙经理, 刘总监,
吴敏, 郑浩, 何静, 唐宁, 许文强, 罗志祥, 林老师 and 郭靖;
- Japanese, Korean and English names are unchanged.
- Missed, with nothing around them that says person: 「模块是谢磊写的」
and 「和黄蓉团队」.
- False positives: none over 2237 lines of the repo's Chinese docs and
i18n, or 61 developer sentences.
- Cost: ~19ms CPU over 880KB.
- Broken by hand:
- with the layer off, TestChineseNames has 8 names unmasked;
- with the two-character guard off before a title, 感谢李老师 goes red.
- Checks:
- gofmt -l is clean;
- go vet is clean on darwin, GOOS=linux -tags nogui and GOOS=windows.
- go test ./... -timeout 45m at load ~750: 63 packages ok, redact
among them. internal/agent (TestReconnectKeepsTheLastPick) and
internal/gateway (TestLargeRequestEndpoints) hit the 45m timeout with
no failed assertion, and are being rerun alone.