From: "Matthew Heaney" <mheaney@on2.com>
Subject: Re: Spellcheck.adb
Date: 26 Apr 2005 11:04:15 -0700
Date: 2005-04-26T11:04:15-07:00 [thread overview]
Message-ID: <1114538655.823821.133630@f14g2000cwb.googlegroups.com> (raw)
In-Reply-To: <1114464642.518876.137610@f14g2000cwb.googlegroups.com>
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;
<http://charles.tigris.org/source/browse/charles/src/ai302/examples/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
next prev parent reply other threads:[~2005-04-26 18:04 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-25 21:30 [Shootout] Spellcheck.adb albert.bachmann
2005-04-25 21:57 ` Spellcheck.adb Albert Bachmann
2005-04-25 23:27 ` [Shootout] Spellcheck.adb Marius Amado Alves
2005-04-26 18:04 ` Matthew Heaney [this message]
2005-04-26 19:36 ` David Sauvage
2005-04-26 20:50 ` Spellcheck.adb Albert Bachmann
2005-04-27 15:11 ` Spellcheck.adb Matthew Heaney
2005-04-27 22:49 ` Spellcheck.adb Albert Bachmann
2005-04-27 23:35 ` Spellcheck.adb Marius Amado Alves
2005-04-27 23:58 ` Spellcheck.adb Albert Bachmann
2005-04-28 0:19 ` Spellcheck.adb Marius Amado Alves
2005-04-29 10:22 ` Spellcheck.adb Albert Bachmann
2005-04-28 0:58 ` Spellcheck.adb Matthew Heaney
2005-04-29 10:19 ` Spellcheck.adb Albert Bachmann
2005-04-28 0:41 ` Spellcheck.adb Matthew Heaney
2005-04-28 21:20 ` Spellcheck.adb Simon Wright
2005-04-29 10:05 ` Spellcheck.adb Albert Bachmann
2005-04-29 12:35 ` Spellcheck.adb Matthew Heaney
2005-04-26 21:21 ` Spellcheck.adb Albert Bachmann
2005-04-26 22:04 ` Spellcheck.adb David Sauvage
2005-04-26 20:36 ` [Shootout] Spellcheck.adb Dmitry A. Kazakov
2005-04-26 21:50 ` David Sauvage
2005-04-27 8:40 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox