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. Add a new LM feature in Moses (HOANG Cong Duy Vu)
----------------------------------------------------------------------
Message: 1
Date: Fri, 15 Aug 2014 10:43:42 +0800
From: HOANG Cong Duy Vu <duyvuleo@gmail.com>
Subject: [Moses-support] Add a new LM feature in Moses
To: moses-support@mit.edu
Message-ID:
<CAPRaJX2nZ-0wRJq9d=tj8MQ-RfksULLyvu1FNDp0YCrBbRp3yQ@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"
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/91470884/attachment.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Factory.cpp
Type: text/x-c++src
Size: 9303 bytes
Desc: not available
Url : http://mailman.mit.edu/mailman/private/moses-support/attachments/20140815/91470884/attachment.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: HybKen.cpp
Type: text/x-c++src
Size: 12106 bytes
Desc: not available
Url : http://mailman.mit.edu/mailman/private/moses-support/attachments/20140815/91470884/attachment-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: HybKen.h
Type: text/x-chdr
Size: 3124 bytes
Desc: not available
Url : http://mailman.mit.edu/mailman/private/moses-support/attachments/20140815/91470884/attachment-0002.bin
------------------------------
_______________________________________________
Moses-support mailing list
Moses-support@mit.edu
http://mailman.mit.edu/mailman/listinfo/moses-support
End of Moses-support Digest, Vol 94, Issue 18
*********************************************
Subscribe to:
Post Comments (Atom)
0 Response to "Moses-support Digest, Vol 94, Issue 18"
Post a Comment