svnno****@sourc*****
svnno****@sourc*****
2009年 9月 6日 (日) 17:38:39 JST
Revision: 1052 http://sourceforge.jp/projects/hiki/svn/view?view=rev&revision=1052 Author: okkez Date: 2009-09-06 17:38:39 +0900 (Sun, 06 Sep 2009) Log Message: ----------- using rack Modified Paths: -------------- hiki/branches/rack/plugin/50bayes_filter.rb Modified: hiki/branches/rack/plugin/50bayes_filter.rb =================================================================== --- hiki/branches/rack/plugin/50bayes_filter.rb 2009-09-06 08:38:36 UTC (rev 1051) +++ hiki/branches/rack/plugin/50bayes_filter.rb 2009-09-06 08:38:39 UTC (rev 1052) @@ -33,7 +33,7 @@ end def html - case @mode =****@cgi*****['bfmode'][0] + case @mode =****@cgi*****['bfmode'] when Mode::SUBMITTED_PAGES r = submitted_pages_html when Mode::SUBMITTED_PAGE_DIFF @@ -69,22 +69,22 @@ @conf[THRESHOLD] ||= 0.9 @conf[THRESHOLD_HAM] ||= 0.1 - if save_mode? and****@cgi*****["from_top"][0] - @conf[USE] =****@cgi*****[USE][0] - @conf[REPORT] =****@cgi*****[REPORT][0] - @conf[SHARE_DB] =****@cgi*****[SHARE_DB][0] - @conf[LIMIT_OF_SUBMITTED_PAGES] =****@cgi*****[LIMIT_OF_SUBMITTED_PAGES][0] || 50 - threshold_spam = (@cgi.params[THRESHOLD][0]||0.95).to_f - threshold_ham = (@cgi.params[THRESHOLD_HAM][0]||0.05).to_f + if save_mode? and****@cgi*****["from_top"] + @conf[USE] =****@cgi*****[USE] + @conf[REPORT] =****@cgi*****[REPORT] + @conf[SHARE_DB] =****@cgi*****[SHARE_DB] + @conf[LIMIT_OF_SUBMITTED_PAGES] =****@cgi*****[LIMIT_OF_SUBMITTED_PAGES] || 50 + threshold_spam = (@cgi.params[THRESHOLD]||0.95).to_f + threshold_ham = (@cgi.params[THRESHOLD_HAM]||0.05).to_f if 0 <= threshold_ham and threshold_ham <= threshold_spam and threshold_spam <= 1.0 @conf[THRESHOLD_HAM] = threshold_ham @conf[THRESHOLD] = threshold_spam end rebuild = false - rebuild = true if****@cgi*****["rebuild_db"][0]=="execute" - if****@cgi*****[TYPE][0] && @cgi.params[TYPE][0]!=@conf[TYPE] - @conf[TYPE] =****@cgi*****[TYPE][0] + rebuild = true if****@cgi*****["rebuild_db"]=="execute" + if****@cgi*****[TYPE] && @cgi.params[TYPE]!=@conf[TYPE] + @conf[TYPE] =****@cgi*****[TYPE] rebuild = true end @@ -181,7 +181,7 @@ end def submitted_page_diff_html - return "" unless data = BayesFilter::PageData.load_from_cache(@cgi.params["id"][0].untaint) + return "" unless data = BayesFilter::PageData.load_from_cache(@cgi.params["id"].untaint) <<EOT <h3>#{Res.submitted_page_diff}</h3> <dl> @@ -196,7 +196,7 @@ end def page_token_html - return "" unless data = BayesFilter::PageData.load_from_cache(@cgi.params["id"][0].untaint) + return "" unless data = BayesFilter::PageData.load_from_cache(@cgi.params["id"].untaint) <<EOT <h3>#{Res.page_token}</h3> #{tokens_html(data.token)} @@ -234,7 +234,7 @@ @cgi.params.keys.select{|k| k=~/\A[HSD]\d+\z/}.each do |id| data = BayesFilter::PageData.load_from_cache(id.dup.untaint, true) next unless data - case****@cgi*****["register_#{id}"][0] + case****@cgi*****["register_#{id}"] when "ham" add_ham(data.token) data.corpus_save(true)