From: Dom Lachowicz (domlachowicz@yahoo.com)
Date: Sun Jul 13 2003 - 14:30:18 EDT
Spell checkers have always been a problem for AbiWord,
and more largely, for almost any application -
especially on Unix. There are a plethora of choices.
None seem to get the job done especially well. They
don't provide a consistent API, if they provide one at
all. Some, if you're lucky, expose an
Ispell-compatible-ish command-line program that you
can popen.
This is a terrible state of affairs, and one that I
hope to remedy. Inspired by these 2 bugs, my general
frustrations, and Aspell's API, I've created Enchant.
http://bugzilla.abisource.com/show_bug.cgi?id=5341
http://bugzilla.abisource.com/show_bug.cgi?id=4724
Enchant is a generic spell checking meta-framework. It
does not strive to actually perform corrections or
provide suggestions. Enchant is basically a manager of
existing spell-checking solutions.
Enchant strives to be as cross-platform as is
reasonable. It does not expose any dependencies on
anything not in the C library. Currently, its
internals depend on some stuff inside of Glib2.0
becuase it's so darn useful, I'd rather not write it
myself at the moment.
Enchant accomplishes this through loading and
unloading provider modules. Also, this allows an
Enchant consumer (and Enchant itself) to be completely
unaware of the backend providers and their
dependencies. Currently, I've written and tested a
Pspell/Aspell provider. I'm going to borrow the
AbiWord Ispell code to create an Ispell provider
soonish. The Hspell folks are going to create a Hspell
provider.
Enchant providers can live in either global scope (eg
/usr/lib/enchant/) or user-private scope (eg
.enchant/). The Ispell provider will also follow
similar rules for where to locate its dictionaries, so
that a user's dict/provider always takes preference.
From a consumer API point of view, you will just ask
Enchant to load a dictionary for "en_US" and it should
"just work". The actual checking engine could be
provided by Ispell, Pspell, or whatever. AbiWord won't
care.
I've created an "enchant_checker.cpp" inside of
src/other/spell/xp that should work. I haven't tried
to compile it, mainly because I'm deathly-afraid of
abi-spell.m4's auto* checks. FJF - can you help me
here?
Enchant's Pspell/Aspell provider is known to work
well. There is a tests/test-enchant program that runs
some simple tasks.
CVS module is 'enchant'. It should compile "out of the
box" on most (if not all) UNIXes. It quite likely will
compile on Win32 if you have GLib-2.0 installed + the
Cygwin or MinGW environments.
I hope to convince other projects to start using this
shortly, especially once we get some more providers.
These "other" projects include (but are not limited
to):
*) GnomeOffice
*) OpenOffice
*) KOffice
*) Gnome-spell
*) Gtk-spell
Dom
__________________________________
Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!
http://sbc.yahoo.com
This archive was generated by hypermail 2.1.4 : Sun Jul 13 2003 - 14:43:34 EDT