[libvoikko] Using the Hfst analyser outside of AnalyzerFactory
Francis Tyers
ftyers at prompsit.com
Thu Sep 26 01:06:45 EEST 2013
El dc 25 de 09 de 2013 a les 20:43 +0300, en/na Harri Pitkänen va
escriure:
> On Wednesday 25 September 2013 14:51:03 Francis Tyers wrote:
> > In grammar/GrammarChecker.hpp, I have defined:
> >
> > RuleEngine * ruleEngine;
> > GcCache gc_cache;
> > morphology::Analyzer * analyser ;
> >
> > The class grammar/CgGrammarChecker.hpp extends this and loads:
> >
> > * An instance of CgRuleEngine into ruleEngine
> >
> > I would like to load an instance of HfstAnalyzer into analyser, but I
> > don't see how I can create an instance without using the
> > AnalyzerFactory, which only allows creation using a setup::Dictionary
> > object.
> >
> > Would it be better to edit AnalyzerFactory and add a method to create
> > analysers only from a path, or is there some other way to get around
> > this ?
>
> I think you can just call
>
> new morphology::HfstAnalyzer(path);
>
> The constructor is missing an implementation right now but the parameter there
> is supposed to contain the path to the directory. So no need to use
> AnalyzerFactory at all. In fact AnalyzerFactory is meant to be used only when
> you don't know (and don't care) about the concrete implementation that will be
> created. There is no need to use it when you know you want HfstAnalyzer.
If I try:
analyser = new morphology::HfstAnalyzer(analyser);
I get:
grammar/CgGrammarChecker.cpp: In constructor
'libvoikko::grammar::CgGrammarChecker::CgGrammarChecker(const string&,
const string&)':
grammar/CgGrammarChecker.cpp:50:50: error: no match for 'operator=' in
'analyser = (operator new(8ul), (<statement>,
((libvoikko::morphology::HfstAnalyzer*)<anonymous>)))'
Any idea ?
Fran
More information about the Libvoikko
mailing list