On Sat, 27 Nov 2004 01:11:47 +0900
Ruby Quiz <james / grayproductions.net> wrote:

> Of course I don't want the ruby community to do a Denial-of-Service on my
> employer's mailserver, so do it as a local filter; perhaps something like this:
> [snip]

Hello Group,

I propose using

  def clean?( text )
    @clean_calls += 1
    @banned_words.each do |word|
      return false if text.include?(word)
    end
    true
  end

in the test filter, because my solution does not work with swedish characters. Trying it with wswedish gives errors when using the regex and no errors when using include?, so I think there must be something weird going on in the regex.

James, be shure to include this kind of words in your test-cases, or specify that it is not needed. I do not want to delve deeper into this.

Regards,

Brian


PS:
Test 1:
Testing with 121430 words and 3 banned words
Took 0.564248085021973 seconds
Used 567 calls
Verified as correct

Test 2
Testing with 121430 words and 126 banned words
Took 6.52887606620789 seconds
Used 5545 calls
Verified as correct

Test 3
Testing with 3930 words and 28 banned words
Took 0.0872080326080322 seconds
Used 497 calls
Verified as correct

-- 
Brian Schröäer
http://www.brian-schroeder.de/