Forums: users (Thread #19248)

--refer-all-headerの要望 (2008-07-08 00:03 by Anonymous #37502)

坂原といいます。
bsfilterのデフォルト及び--refer-headerオプションは「特定のヘッダのみ参照し、他は無視する」動作をしますが、「全てのヘッダを参照する」(または再学習の際などに副作用が出ないよう、「指定したヘッダのみ無視する」)オプションもあると良いと思います。

実際、私は現在bsfilterを--refer-headerオプションなしで使用していますが、本文などに既知情報が殆どなくほぼ確率0.5ですり抜けてきてしまうspamの中に、無視しているヘッダには特徴が見て取れるものもあるように思います。
"Better Bayesian Filtering"にも
"There is a lesson here for filter writers: don't ignore data."
とあります。

--refer-headerにX-***などを片端から書き連ねるという方法もなくはないでしょうが、ちょっと思想が違う気がしますし。
全てのヘッダを参照した際に、予想される副作用などはありますでしょうか?
それが甚大なものでなければ、是非オプションの追加実装をご検討頂けると幸いです。

Reply to #37502×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

RE: --refer-all-headerの要望 (2008-07-17 00:22 by nabeken #37640)

revision 1.85.2.3 で --refer-all-header オプションを追加してみました。
メールの言語を判定するためにヘッダを見るときがあるのですが、その際には、--refer-all-headerを指定していても、特定のヘッダのみを参照します。
Reply to #37502

Reply to #37640×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

RE: --refer-all-headerの要望 (2008-07-24 02:31 by Anonymous #37793)

お応え頂き、ありがとうございます。早速に試させて頂きます。
坂原
Reply to #37502

Reply to #37793×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

RE: --refer-all-headerの要望 (2008-09-24 15:03 by Anonymous #38993)

坂原です。
2ヶ月間、--refer-all-headerで運用していますが、効果は上々です。spam確率0.5付近のメールが大幅に減少し、それに伴って見逃しも大幅に減りました。感謝、感謝です。
以上手短ながら報告いたします。
Reply to #37793

Reply to #38993×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login

RE: --refer-all-headerの要望 (2013-03-14 15:54 by ykasahara #67670)

--refer-all-header した時に SpamAssassin などのヘッダを喰ってしまうのが気持ち悪いので、--ignore-header を --ignore-all-header に移して --ignore-header x-spam-status とか書けるようにしてみました。

SF.jp ではパッチをどう扱うのがいいのかわからないのでここに貼ります…(空白消えたりしたらすみません)。
1.0.17 へのパッチです。オプション名等はおまかせします。
デフォルトは空にしていますが、再学習時を考えると header-prefix を見て bsfilter 自身がつけるヘッダは
除くのがいいかもしれないです。

--- /usr/local/bin/bsfilter.old 2012-01-16 01:09:11.833313127 +0900
+++ /usr/local/bin/bsfilter 2013-03-14 15:43:19.205754094 +0900
@@ -1198,7 +1198,7 @@

# "authentication-results", "domainkey-signature"
headers.each do |header, content|
- if (@options["refer-all-header"] || @options["refer-header"][header])
+ if ( (@options["refer-all-header"] && (not @options["ignore-header"][header])) || @options["refer-header"][header] )
if (lang == "ja")
content.gsub!(/=\?utf\-8\?([bq])\?(\S*)\?=/i) do |s|
b_or_q = $1
@@ -2088,7 +2088,12 @@
--refer-all-header
refer all headers of mails

- --ignore-header|-H
+ --ignore-header header[,header...]
+ ignore specified headers of mails
+ (use with --refer-all-header)
+ "" by default
+
+ --ignore-all-header|-H
ignore headers of mails
same as --refer-header ""

@@ -3025,7 +3030,8 @@
["--ignore-body", "-B", GetoptLong::NO_ARGUMENT],
["--refer-header", GetoptLong::REQUIRED_ARGUMENT],
["--refer-all-header", GetoptLong::NO_ARGUMENT],
- ["--ignore-header", "-H", GetoptLong::NO_ARGUMENT],
+ ["--ignore-header", GetoptLong::REQUIRED_ARGUMENT],
+ ["--ignore-all-header", "-H", GetoptLong::NO_ARGUMENT],
["--ignore-plain-text-part", GetoptLong::NO_ARGUMENT],
["--ignore-after-last-atag", GetoptLong::NO_ARGUMENT],
["--pipe", GetoptLong::NO_ARGUMENT],
@@ -3171,7 +3177,7 @@

if (options["refer-header"])
array = options["refer-header"].downcase.split(',')
- elsif (options["ignore-header"])
+ elsif (options["ignore-all-header"])
array = Array::new
else
array = Default_refer_header.downcase.split(',')
@@ -3181,6 +3187,16 @@
options["refer-header"][header] = true
end

+ if (options["ignore-header"])
+ array = options["ignore-header"].downcase.split(',')
+ else
+ array = Array::new
+ end
+ options["ignore-header"] = Hash::new
+ array.each do |header|
+ options["ignore-header"][header] = true
+ end
+
options["use-body"] = options["ignore-body"] ? false : true

options["pid-file"] = options["homedir"] + Default_pid_file if (! options["pid-file"])

ご検討よろしくお願いします。
Reply to #37502

Reply to #67670×

You can not use Wiki syntax
You are not logged in. To discriminate your posts from the rest, you need to pick a nickname. (The uniqueness of nickname is not reserved. It is possible that someone else could use the exactly same nickname. If you want assurance of your identity, you are recommended to login before posting.) Login