Re: spell checking api "enchant" - adding a new spell checker

From: Dominic Lachowicz <domlachowicz_at_gmail.com>
Date: Fri Mar 23 2012 - 00:59:43 CET

Hi ge,

Enchant exposes a C/C++ plug-in API. For your purposes, the voikko
plugin is probably a good starting point.
http://www.abisource.com/viewvc/enchant/trunk/src/voikko/voikko_provider.c?view=markup

The plugin exposes a single entry point: init_enchant_provider(). The
EnchantProvider object describes the plugin, lets you query which
languages are supported, and lets you request dictionaries for the
supported languages. Importantly, all of the strings in the plug-in
API assume a UTF-8 character encoding. The EnchantProvider object has
a number of virtual methods:

* dispose() free's the EnchantProvider.
* request_dict() returns a dictionary (or NULL) for the requested language
* dispose_dict() free's the object returned by request_dict()
* dictionary_exists() returns a boolean depending on whether the
plugin supports the requested language. This method is optional.
* identify() provides a name that uniquely identifies the plugin. This
is used by enchant internally - eg. you can prefer one plugin over
another for a given language. Those preferences use the name returned
by "identify()"
* describe() returns an English human-readable string describing the plugin
* list_dicts() returns all of the languages supported by this plugin
* free_string_list() free's a string list

The dictionary object actually is responsible for the spell-checking.
It also optionally supports personal dictionaries/word lists. If you
do not provide this functionality, enchant will emulate this for you
using Tries. You must override at least the following 2 methods:

* check() returns a boolean value. 0 means "the word is a legal word".
1 means "the word isn't in the dictionary" and -1 means "error"
* suggest() returns a string list of ordered suggestions for the given
misspelled word

I hope that's a helpful start.

Cheers,
Dom

On Thu, Mar 22, 2012 at 6:32 PM, ge <eleonora46@gmx.net> wrote:
>
> Hi Dom,
>
> I will be glad to document that in the wiki.
> As a starting point a little example would be ideal, a little mickey mouse checker in C, and an illustration, how to provide enchant api for the little
> mickey-mouse checker.
>
> Thanks in advance, best.
>
> Hi ge,
>
> I'm happy to help out, with the provision that you'll edit & post our
> conversation on the Abiword Wiki for others to benefit from.
>
> Thanks,
> Dom
>
>
>

-- 
"I like to pay taxes. With them, I buy civilization." --  Oliver Wendell Holmes
Received on Fri Mar 23 00:59:53 2012

This archive was generated by hypermail 2.1.8 : Fri Mar 23 2012 - 00:59:53 CET