lep*_*epe 5 spam spamassassin utf-8
我住在日本。最近有很多来自中国的垃圾邮件,邮件都是用中文写的。由于 spamassassin 不包含中文规则,因此大多数电子邮件以低分通过。
我想确定何时仅用中文撰写电子邮件。由于大多数日语汉字都包含在中文范围内(U+E400 到 U+E9FF),识别日语的一种方法是查看平假名(U+3040 到 U+309F)和片假名(U+30A0 到 U +30FF)。如果它包含平假名或片假名,我可以肯定地认为是日语,否则是中文。
如果我测试单个字符,例如:?或者?它们正确匹配,但是当我使用范围时它不起作用。这是我们尝试过的:
body CHINESE /[\xe4-\xe9]/ <--- this form seems to work fine
body JAPANESE /[\x30-\x31]/ <--- not sure what is actually matching
body JAPANESE /(?|?)/ <---- this matches single character just fine
body JAPANESE /[?-?]/ <--- doesn't work
body JAPANESE /[U+3040-U+30FF]/ <--- doesn't work
body JAPANESE /[\xe3\x81\x81-\xe3\x82\x96]/ <--- doesn't work
body JAPANESE /[\x{3040}-\x{30FF}]/ <--- doesn't work
Run Code Online (Sandbox Code Playgroud)
我真的不知道我在做什么了。我知道上面的一些没有意义......
指定这些范围的正确方法是什么?
您是否尝试过使用 Mail::SpamAssassin::Plugin::TextCat(语言检测器)?
恕我直言,您应该首先考虑/评估它。
header LANGUAGE_ZH X-Languages =~ /\b(?:zh)\b/
describe LANGUAGE_ZH Chinese language
score LANGUAGE_ZH 1.0
header LANGUAGE_JA X-Languages =~ /\b(?:ja)\b/
describe LANGUAGE_JA Japanese language
score LANGUAGE_JA -0.1
Run Code Online (Sandbox Code Playgroud)
您可以修改它以匹配“仅检测/猜测一种语言”或某些语言组合。
警告:确保您的 SpamAssassin 配置加载了插件。
它是/etc/spamassassin/v310.pre在 Debian Linux 上的文件中配置的。