In article <20020923184022.GA1056 / hannibal>, gminick wrote:
> On Tue, Sep 24, 2002 at 12:22:56AM +0900, Vincent Foley wrote:
>> I other numbers, when I searched for any 6-letter word, here are the
>> time outputs:
> Please, show the code ;)
> 

Ruby (that code has a serious bug though, see my thread, about
String#gsub!):

[code]
#!/usr/bin/env ruby

wordList = open('/home/vince/fr_dict.txt', 'r').read.split('\n')
repl = {
    '_'   => '[a-',
    '(v)' => '[aäâñÆðìõÊüñoôöuûù]', 
    '(c)' => '[bcdfghjklmnpqrstvwxyz]',
    '(e)' => '[ñÆðìõ¾'
}    

while true
  print '> '
  reg = gets.chomp
  repl.each_key { |token|
    reg.gsub!(token, repl[token])
  }
  reg = '^' << reg << '$'
  puts reg
  for word in wordList
    puts word if word =~ reg
  end
end
[/code]

Python (this code  works perfectly.  Doesn't have the ruby version bug)
[code]
#!/usr/bin/env python2.2

import re

_wordList = (open('/home/vince/fr_dict.txt', 'r').read()).split('\n')
_repl = {
    '_': '[a-',
    '(v)': '[aäâñÆðìõÊüñoôöuûù]', 
    '(c)': '[bcdfghjklmnpqrstvwxyz]',
    '(e)': '[ñÆðìõ¾'
}    


while 1:
    reg = raw_input('> ')
    for token in _repl:
        reg = reg.replace(token, _repl[token])
    reg = "%s%s%s" % ('^', reg, '$')
    reg = re.compile(reg, re.I)
    for word in _wordList:
        if reg.search(word):
            print word
[/code]

There ya go.  If you ahve any information about why I have that bug in
the Ruby version, please let met know ASAP ;)  

Vincent

-- 

Vincent Foley-Bourgon
Email: vinfoley / iquebec.com
Homepage: http://darkhost.mine.nu:81