[libvoikko] different output via voikkogc and libreoffice-voikko
Francis Tyers
ftyers at prompsit.com
Thu Oct 3 13:39:14 EEST 2013
El dt 01 de 10 de 2013 a les 20:51 +0300, en/na Harri Pitkänen va
escriure:
> 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)
> example.
So I have the following problem:
voikko_options_t contains a grammar::GrammarChecker
This is instantiated by grammar::GrammarCheckerFactory
grammar::GrammarChecker contains:
grammar::RuleEngine
grammar::GcCache
morphology::Analyzer
RuleEngine can be either CgRuleEngine or FinnishRuleEngine
In order for FinnishRuleEngine to get voikkoOptions, I need to pass it
via the interface in RuleEngine.hpp:
virtual void check(voikko_options_t * voikkoOptions, const Paragraph *
para) = 0;
However, when I do this, I get the following error:
./grammar/RuleEngine.hpp:46:22: error: 'voikko_options_t' has not been
declared
If I try forward declaring in the libvoikko namespace:
./grammar/RuleEngine.hpp:39:8: error: 'struct
libvoikko::voikko_options_t' has a previous declaration as 'struct
libvoikko::voikko_options_t'
spellchecker/spell.cpp: In function
'libvoikko::spellchecker::spellresult
libvoikko::hyphenAwareSpell(libvoikko::voikko_options_t*, const
wchar_t*, size_t)':
spellchecker/spell.cpp:55:35: error: invalid use of incomplete type
'struct libvoikko::voikko_options_t'
I don't know why the grammar checker stuff is being included in the
spellchecker.
Any thoughts on how to get around this ? I've been fiddling for a day
now and feel like I'm just stabbing blindly in the dark.
Fran
More information about the Libvoikko
mailing list