-- -*- mode: eiffel -*-
-- $Id: spellcheck.se,v 1.3 2001/05/23 18:24:46 doug Exp $
-- http://www.bagley.org/~doug/shootout/
-- from Steve Thompson

-- <LOC-OFF>
indexing
   description: "This class performs the spell check test" 
   author : Steve Thompson
   email  : "Steve_Thompson@prodigy.net"
   date   : February 18, 2001
   compile: "compile -clean -boost -no_split -O3 main.e -o main"
   run    : "main < Input"
-- <LOC-ON>

class SPELLCHECK

creation make
   
feature -- Creation
   
   make is
      do
     read_dictionary
     from
        std_input.read_line 
     until std_input.end_of_input loop
        if dictionary.has(std_input.last_string) = False then
           print(std_input.last_string + "%N")
        end
        std_input.read_line
     end 
      end -- make
   
feature -- Queries
   
   dictionary: DICTIONARY[INTEGER, STRING]
   
feature -- Commands
   
   read_dictionary is
      local
     file: STD_FILE_READ
     value: INTEGER 
      do
     value := 1
     from
        !!dictionary.with_capacity(60000)
        !!file.connect_to("Usr.Dict.Words")
     until
        file.end_of_input
     loop
        file.read_line
        dictionary.add(value, file.last_string)
     end
     file.disconnect
      end -- read_dictionary

end