Extending / Chaining Spell Checker

Stephan Bergmann sbergman at redhat.com
Thu May 30 04:22:17 PDT 2013


On 05/30/2013 12:46 PM, Guenter Bartsch wrote:
> we're currently trying to implement a small, db-based terminology
> checker plugin. essentially, this plugin will check for certain
> phrases in a document and offer replacements for faulty ones.
>
> a first implementation works, however, the spell checker gets in the
> way: since we implemented our extension as a grammer checker plugin,
> the spell checker will complain about certain (potentially correct)
> technical terms not found in its dictionary.
>
> now, we're planning to implement our own spell checker that goes along
> with the grammer checker. it's only purpose would be to accept all the
> technical words in the database and hand through all other words to
> the real spell checker (i.e. hunspell)
>
> is this possible? is there a mechanism to chain several spell checker
> plugins? i.e. could explicitly instantiate the hunspell checker and
> hand through all function calls to it?
>
> something like:
>
>                  print ("Speller: instatiating hunspell...")
>
>                  smgr = ctx.ServiceManager
>                  hunspell = smgr.createInstanceWithContext(
> "org.openoffice.lingu.HspellHunspellChecker", ctx)
>
>                  print ("Speller: hunspell instance: %s" % repr(hunspell))
>
> would be nice - however, we'd have to be able to specify an
> instantiation name instead of a service name when instantiating the
> object.

The following comment in 
offapi/com/sun/star/linguistic2/XLinguServiceManager.idl might be what 
you are looking for:

"For spell checking and thesaurus, the order in the list defines the 
order of creation/usage of those services. That is, if the first spell 
checker implementation does not recognize the given word as correct, the 
second service implementation for that language is created and gets 
queried. If that one fails, the third one gets created and queried and 
so on. This chain stops if an implementation reports the word as correct 
or the end of the list is reached, in which case the word is reported as 
incorrect."

Stephan




More information about the LibreOffice mailing list