From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,64fc02e079586f1b X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!f14g2000cwb.googlegroups.com!not-for-mail From: "Matthew Heaney" Newsgroups: comp.lang.ada Subject: Re: Spellcheck.adb Date: 26 Apr 2005 11:04:15 -0700 Organization: http://groups.google.com Message-ID: <1114538655.823821.133630@f14g2000cwb.googlegroups.com> References: <1114464642.518876.137610@f14g2000cwb.googlegroups.com> NNTP-Posting-Host: 66.162.65.162 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1114538660 27910 127.0.0.1 (26 Apr 2005 18:04:20 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 26 Apr 2005 18:04:20 +0000 (UTC) In-Reply-To: <1114464642.518876.137610@f14g2000cwb.googlegroups.com> User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: f14g2000cwb.googlegroups.com; posting-host=66.162.65.162; posting-account=Zl1UPAwAAADEsUSm1PMMiDjihtBlZUi_ Xref: g2news1.google.com comp.lang.ada:10727 Date: 2005-04-26T11:04:15-07:00 List-Id: albert.bachmann@gmx.de wrote: > > > First I post the C++ solution since it is much shorter and easy to > understand: The Ada solution based on the Ada 2005 standard container library isn't much different from your C++ example: with Hashed_Word_Sets; use Hashed_Word_Sets; with Ada.Text_IO; use Ada.Text_IO; procedure Spellcheck is Words : Set; Line : String (1 .. 132); Last : Natural; File : File_Type; begin Open (File, In_File, "spellcheck-dict.txt"); while not End_Of_File (File) loop Get_Line (File, Line, Last); Insert (Words, New_Item => Line (Line'First .. Last)); end loop; while not End_Of_File loop Get_Line (Line, Last); if not Contains (Words, Item => Line (Line'First .. Last)) then Put_Line (Line (Line'First .. Last)); end if; end loop; end Spellcheck; We did determine that the hash function doesn't perform well for small strings, but I haven't fixed it yet. If you're desperate I can fix it tonight. -Matt