[libvoikko] different output via voikkogc and libreoffice-voikko

Harri Pitkänen hatapitk at iki.fi
Tue Oct 1 20:51:29 EEST 2013

On Tuesday 01 October 2013 16:00:26 Francis Tyers wrote:
> I have a problem though. A lot of the checks in FinnishRuleEngine/ rely
> on stuff from voikko_options_t. The new abstraction doesn't let them
> have it, they only get a GcCache to work with. IMHO these variables:
> 	int ignore_dot;
> 	int ignore_numbers;
> 	int ignore_uppercase;
> 	int ignore_nonwords;
> 	int accept_first_uppercase;
> 	int accept_all_uppercase;
> 	int accept_extra_hyphens;
> 	int accept_missing_hyphens;
> 	int accept_titles_in_gc;
> 	int accept_unfinished_paragraphs_in_gc;
> 	int accept_bulleted_lists_in_gc;
> should be put into the GrammarChecker class. I'm not quite sure if this
> will break other stuff. But the main thing is that I think it would be
> good if this was kept closer to the code that is using it.

You most likely cannot avoid passing a pointer to voikko_options_t to 
FinnishGrammarChecker. That should not break the abstraction as you can just 
pass it through the constructor. See SpellerFactory for a (rather complicated) 

Many of the options you listed above can be used for grammar checking but most 
of them (also) affect spell checking. The code that sets the options cannot 
really know where the options are needed as for some options this depends on 
the backend and/or language. Since the values for the options are not known 
when the components are initialized (they can only be changed after voikkoInit 
has completed) it is rather important that there is only one copy of the 
structure that holds these options.

An alternative to the current implementation that would allow the backend 
objects to maintain their own settings would be to use the observer pattern to 
notify the backends when some of their settings may need to be updated. But 
that would be rather complicated to implement and most likely not worth the 


More information about the Libvoikko mailing list