Hi Christian, It works now. Thanks!
-- Cheers, Vu On Fri, Aug 15, 2014 at 12:00 PM, Christian Hadiwinoto < [email protected]> wrote: > Hi, > > > > Have you added the “HybKen.cpp” after “alias LM” in the Jamfile? > > > > I hope this helps. > > > > Regards, > > Christian Hadiwinoto > > > > *From:* [email protected] [mailto: > [email protected]] *On Behalf Of *HOANG Cong Duy Vu > *Sent:* Friday, August 15, 2014 10:44 AM > *To:* [email protected] > *Subject:* [Moses-support] Add a new LM feature in Moses > > > > Hi, > > > > I would like to add a new simple LM named HybLanguageModelKen (HybKen.h > and HybKen.cpp) which will inherit from LanguageModelKen. > > > > In Factory.cpp, I added as follows: > > > > ... > > //#include "moses/LM/Ken.h" > > #include "moses/LM/HybKen.h" > > ... > > > > class KenFactory : public FeatureFactory > > { > > public: > > void Create(const std::string &line) { > > DefaultSetup(ConstructKenLM(line)); > > } > > }; > > > > class HybKenFactory : public FeatureFactory > > { > > public: > > void Create(const std::string &line) { > > DefaultSetup(ConstructHybKenLM(line)); > > } > > }; > > > > ... > > Add("KENLM", new KenFactory()); > > > > Add("HKENLM", new HybKenFactory()); > > > > ... > > > > I've created HybKen.h as follows: > > > > #ifndef moses_LanguageModelHybKen_h > > #define moses_LanguageModelHybKen_h > > > > //#include <string> > > //#include <boost/shared_ptr.hpp> > > > > //#include "lm/word_index.hh" > > > > //#include "moses/LM/Base.h" > > //#include "moses/Hypothesis.h" > > //#include "moses/TypeDef.h" > > //#include "moses/Word.h" > > > > #include "moses/LM/Ken.h" > > namespace Moses > > { > > > > LanguageModel *ConstructHybKenLM(const std::string &line); > > > > //! This will also load. Returns a templated KenLM class > > LanguageModel *ConstructHybKenLM(const std::string &line, const > std::string &file, const std::string &fileM, FactorType factorType, bool > lazy); > > > > void LoadMapping(const std::string &f, std::map<std::string, std::string>& > m); > > > > /* > > * An implementation of single factor LM using Kenneth's code. > > */ > > template <class Model> class LanguageModelHybKen : public > LanguageModelKen<Model> > > { > > ... > > > > Factory.cpp, HybKen.h and HybKen.cpp are attached for your reference. > > > > But I always got the compilation error message: "*moses/FF/Factory.cpp:166: > error: undefined reference to 'Moses::ConstructHybKenLM(std::string const&)* > '". > > I understand that Moses::ConstructHybKenLM(std::string const&) is already > defined in Moses namespace. > > > > May I ask for your help? > > > > Thank you! > > > > -- > Cheers, > Vu >
_______________________________________________ Moses-support mailing list [email protected] http://mailman.mit.edu/mailman/listinfo/moses-support
