Extending / Chaining Spell Checker
Guenter Bartsch
guenter.bartsch at gmail.com
Fri May 31 14:19:22 PDT 2013
On Fri, May 31, 2013 at 10:34 PM, Guenter Bartsch
<guenter.bartsch at gmail.com> wrote:
> Stephan,
>
> On Thu, May 30, 2013 at 1:22 PM, Stephan Bergmann <sbergman at redhat.com> wrote:
>> 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."
>
> one more question about this: as soon as I activate my own spell
> checker in addition to hunspell, I do not get any spelling suggestions
> for misspelled words anymore (context menu). of course, my own spell
> checker implementation does not provide any suggestions
>
> def spell(self, aWord, aLocale, aProperties ):
> return None
>
> but surely hunspell does - how do suggestions work in such a chained
> spell checker setup? any way to collect them from all plugins?
just a quick update: I implemented a quick workaround for now, which
has hunspell/myspell hardcoded. it seems to be working for now:
def spell(self, aWord, aLocale, aProperties ):
if not self.myspell:
self.myspell = self.service_manager.createInstance
("org.openoffice.lingu.MySpellSpellChecker")
if self.myspell:
return self.myspell.spell (aWord, aLocale, aProperties)
return None
More information about the LibreOffice
mailing list