mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-08-16 06:50:32 +03:00
make LanguageModelImplementation have new format constructor
This commit is contained in:
parent
165ed39296
commit
1a1634a391
@ -40,6 +40,7 @@ using namespace std;
|
||||
namespace Moses
|
||||
{
|
||||
LanguageModelIRST::LanguageModelIRST(const std::string &line)
|
||||
:LanguageModelSingleFactor("IRSTLM", line)
|
||||
{
|
||||
cerr << "line=" << line << endl;
|
||||
FactorType factorType;
|
||||
@ -68,11 +69,6 @@ LanguageModelIRST::LanguageModelIRST(const std::string &line)
|
||||
Load(filePath, factorType, nGramOrder);
|
||||
}
|
||||
|
||||
LanguageModelIRST::LanguageModelIRST(int dub)
|
||||
:m_lmtb(0),m_lmtb_dub(dub)
|
||||
{
|
||||
}
|
||||
|
||||
LanguageModelIRST::~LanguageModelIRST()
|
||||
{
|
||||
|
||||
|
@ -64,7 +64,6 @@ protected:
|
||||
public:
|
||||
LanguageModelIRST(const std::string &line);
|
||||
|
||||
LanguageModelIRST(int dub);
|
||||
~LanguageModelIRST();
|
||||
bool Load(const std::string &filePath
|
||||
, FactorType factorType
|
||||
|
@ -63,7 +63,10 @@ protected:
|
||||
Word m_sentenceStartArray, m_sentenceEndArray; //! Contains factors which represents the beging and end words for this LM.
|
||||
//! Usually <s> and </s>
|
||||
|
||||
LanguageModelImplementation(const std::string& description, const std::string &line)
|
||||
{}
|
||||
public:
|
||||
|
||||
virtual ~LanguageModelImplementation() {}
|
||||
|
||||
//! Single or multi-factor
|
||||
|
@ -49,7 +49,9 @@ protected:
|
||||
|
||||
size_t m_implFactor;
|
||||
public:
|
||||
LanguageModelJoint(LanguageModelSingleFactor *lmImpl) {
|
||||
LanguageModelJoint(const std::string &line, LanguageModelSingleFactor *lmImpl)
|
||||
:LanguageModelMultiFactor("JointLM", line)
|
||||
{
|
||||
m_lmImpl = lmImpl;
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,9 @@ class LanguageModelMultiFactor : public LanguageModelImplementation
|
||||
protected:
|
||||
FactorMask m_factorTypes;
|
||||
|
||||
LanguageModelMultiFactor(){}
|
||||
LanguageModelMultiFactor(const std::string& description, const std::string &line)
|
||||
:LanguageModelImplementation(description, line)
|
||||
{}
|
||||
|
||||
public:
|
||||
virtual bool Load(const std::string &filePath
|
||||
|
@ -20,8 +20,10 @@ class Phrase;
|
||||
class LanguageModelORLM : public LanguageModelSingleFactor {
|
||||
public:
|
||||
typedef count_t T; // type for ORLM filter
|
||||
LanguageModelORLM()
|
||||
: m_lm(0) {}
|
||||
LanguageModelORLM(const std::string &line)
|
||||
:LanguageModelSingleFactor("ORLM", line)
|
||||
,m_lm(0)
|
||||
{}
|
||||
bool Load(const std::string &filePath, FactorType factorType, size_t nGramOrder);
|
||||
virtual LMResult GetValue(const std::vector<const Word*> &contextFactor, State* finalState = NULL) const;
|
||||
~LanguageModelORLM() {
|
||||
|
@ -69,6 +69,10 @@ private:
|
||||
WidMatrix *widMatrix;
|
||||
|
||||
public:
|
||||
LanguageModelParallelBackoff(const std::string &line)
|
||||
:LanguageModelMultiFactor("ParallelBackoffLM", line)
|
||||
{}
|
||||
|
||||
~LanguageModelParallelBackoff();
|
||||
|
||||
bool Load(const std::string &filePath, const std::vector<FactorType> &factorTypes, size_t nGramOrder);
|
||||
@ -347,9 +351,6 @@ const FFState *LanguageModelParallelBackoff::GetBeginSentenceState() const
|
||||
|
||||
}
|
||||
|
||||
LanguageModelMultiFactor *NewParallelBackoff() {
|
||||
return new LanguageModelParallelBackoff();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -24,10 +24,5 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
namespace Moses
|
||||
{
|
||||
|
||||
class LanguageModelMultiFactor;
|
||||
|
||||
/** @todo what is this?
|
||||
*/
|
||||
LanguageModelMultiFactor *NewParallelBackoff();
|
||||
|
||||
}
|
||||
|
@ -38,9 +38,10 @@ using namespace std;
|
||||
|
||||
namespace Moses
|
||||
{
|
||||
LanguageModelSRI::LanguageModelSRI()
|
||||
: m_srilmVocab(0)
|
||||
, m_srilmModel(0)
|
||||
LanguageModelSRI::LanguageModelSRI(const std::string &line)
|
||||
:LanguageModelSingleFactor("SRILM", line)
|
||||
,m_srilmVocab(0)
|
||||
,m_srilmModel(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ protected:
|
||||
unsigned int GetLmID( const Factor *factor ) const;
|
||||
|
||||
public:
|
||||
LanguageModelSRI();
|
||||
LanguageModelSRI(const std::string &line);
|
||||
~LanguageModelSRI();
|
||||
bool Load(const std::string &filePath
|
||||
, FactorType factorType
|
||||
|
@ -49,7 +49,8 @@ struct PointerState : public FFState {
|
||||
}
|
||||
};
|
||||
|
||||
LanguageModelSingleFactor::LanguageModelSingleFactor()
|
||||
LanguageModelSingleFactor::LanguageModelSingleFactor(const std::string& description, const std::string &line)
|
||||
:LanguageModelImplementation(description, line)
|
||||
{
|
||||
m_nullContextState = new PointerState(NULL);
|
||||
m_beginSentenceState = new PointerState(NULL);
|
||||
|
@ -43,7 +43,7 @@ protected:
|
||||
FFState *m_nullContextState;
|
||||
FFState *m_beginSentenceState;
|
||||
|
||||
LanguageModelSingleFactor();
|
||||
LanguageModelSingleFactor(const std::string& description, const std::string &line);
|
||||
|
||||
public:
|
||||
virtual ~LanguageModelSingleFactor();
|
||||
|
Loading…
Reference in New Issue
Block a user