[libvoikko] grammar checker loading
Harri Pitkänen
hatapitk at iki.fi
Thu Sep 19 19:27:20 EEST 2013
On Thursday 19 September 2013 14:34:39 Francis Tyers wrote:
> * The DictionaryLoader and friends classes don't seem to be overly
> friendly to grammar checking. Aside from the name (a grammar checker
> isn't a dictionary, although it may contain one). Should there be a new
> class for loading / setting up the grammar checker ? This would involve
> adding some stuff to voikko_options_t and make a new class to be called
> from voikkoInit() which goes and finds valid grammar checkers.
Yes. Perhaps if you created a class grammar::GrammarChecker with two member
variables
grammar::RuleEngine * ruleEngine;
grammar::GcCache gc_cache;
then you could remove gc_cache from voikko_options_t and replace it with
grammar::GrammarChecker * grammarChecker;
Loading the grammar checkers in a separate class might also make sense. For
FinnishRuleEngine the logic would be
- go through all previously loaded dictionaries
* if language == "fi" and analyzer is an instance of MalagaAnalyzer or
VfstAnalyzer then
assign grammarChecker =
new GrammarChecker(new FinnishRuleEngine(analyzer))
> * libvoikko now links with hfst-ospell and not hfst-optimised-lookup.
> hfst-ospell can do analyses, but it means encapsulating everything in
> a .zhfst file, which might not be what we want. Can we link with both
> hfst-optimised-lookup and hfst-ospell ? A further complication(?) is
> that the hfst-ospell namespace seems to be called hfst_ol (this confused
> me at first).
>
> * These decisions might take some thought, so at the moment I might just
> start with linking with hfst-optimised-lookup and hardcoding everything
> in the new grammar/HfstAnalysis.cpp. We can always modularise it later.
This sounds good to me.
Harri
More information about the Libvoikko
mailing list