Send Moses-support mailing list submissions to
moses-support@mit.edu
To subscribe or unsubscribe via the World Wide Web, visit
http://mailman.mit.edu/mailman/listinfo/moses-support
or, via email, send a message with subject or body 'help' to
moses-support-request@mit.edu
You can reach the person managing the list at
moses-support-owner@mit.edu
When replying, please edit your Subject line so it is more specific
than "Re: Contents of Moses-support digest..."
Today's Topics:
1. Re: Add a new LM feature in Moses (Christian Hadiwinoto)
2. Re: Add a new LM feature in Moses (HOANG Cong Duy Vu)
----------------------------------------------------------------------
Message: 1
Date: Fri, 15 Aug 2014 12:00:03 +0800
From: "Christian Hadiwinoto" <chrhad@comp.nus.edu.sg>
Subject: Re: [Moses-support] Add a new LM feature in Moses
To: <duyvuleo@gmail.com>, <moses-support@mit.edu>
Message-ID: <005a01cfb83d$652a71b0$2f7f5510$@nus.edu.sg>
Content-Type: text/plain; charset="utf-8"
Hi,
Have you added the ?HybKen.cpp? after ?alias LM? in the Jamfile?
I hope this helps.
Regards,
Christian Hadiwinoto
From: moses-support-bounces@mit.edu [mailto:moses-support-bounces@mit.edu] On Behalf Of HOANG Cong Duy Vu
Sent: Friday, August 15, 2014 10:44 AM
To: moses-support@mit.edu
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/mailman/private/moses-support/attachments/20140815/2f68c404/attachment-0001.htm
------------------------------
Message: 2
Date: Fri, 15 Aug 2014 12:52:03 +0800
From: HOANG Cong Duy Vu <duyvuleo@gmail.com>
Subject: Re: [Moses-support] Add a new LM feature in Moses
To: chrhad@comp.nus.edu.sg
Cc: moses-support@mit.edu
Message-ID:
<CAPRaJX3pB4jLj3SZgTBXu_E5Rj_Ood9EmZnDfakvz-a8c1F6Vg@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
Hi Christian,
It works now. Thanks!
--
Cheers,
Vu
On Fri, Aug 15, 2014 at 12:00 PM, Christian Hadiwinoto <
chrhad@comp.nus.edu.sg> wrote:
> Hi,
>
>
>
> Have you added the ?HybKen.cpp? after ?alias LM? in the Jamfile?
>
>
>
> I hope this helps.
>
>
>
> Regards,
>
> Christian Hadiwinoto
>
>
>
> *From:* moses-support-bounces@mit.edu [mailto:
> moses-support-bounces@mit.edu] *On Behalf Of *HOANG Cong Duy Vu
> *Sent:* Friday, August 15, 2014 10:44 AM
> *To:* moses-support@mit.edu
> *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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/mailman/private/moses-support/attachments/20140815/4abb8020/attachment.htm
------------------------------
_______________________________________________
Moses-support mailing list
Moses-support@mit.edu
http://mailman.mit.edu/mailman/listinfo/moses-support
End of Moses-support Digest, Vol 94, Issue 19
*********************************************
Subscribe to:
Post Comments (Atom)
0 Response to "Moses-support Digest, Vol 94, Issue 19"
Post a Comment