diff options
author | Hieu Hoang <hieuhoang@gmail.com> | 2016-09-29 12:38:01 +0300 |
---|---|---|
committer | Hieu Hoang <hieuhoang@gmail.com> | 2016-09-29 12:38:01 +0300 |
commit | 8e619c67fa13de2032d60800905699dc3ad21a01 (patch) | |
tree | ee6892b08229808b969240ef2f7200d7c5fe86ce | |
parent | cab564f607864f17ab6f51352fb69e2951712027 (diff) |
begin import of Compact pt
-rw-r--r-- | contrib/moses2/FF/FeatureRegistry.cpp | 2 | ||||
-rw-r--r-- | contrib/moses2/Jamfile | 9 | ||||
-rw-r--r-- | contrib/moses2/TranslationModel/PhraseTableCompact.cpp | 62 | ||||
-rw-r--r-- | contrib/moses2/TranslationModel/PhraseTableCompact.h | 40 |
4 files changed, 109 insertions, 4 deletions
diff --git a/contrib/moses2/FF/FeatureRegistry.cpp b/contrib/moses2/FF/FeatureRegistry.cpp index b040eb8a1..ec3cffede 100644 --- a/contrib/moses2/FF/FeatureRegistry.cpp +++ b/contrib/moses2/FF/FeatureRegistry.cpp @@ -1,6 +1,7 @@ #include "FeatureRegistry.h" #include "../TranslationModel/Memory/PhraseTableMemory.h" +#include "../TranslationModel/PhraseTableCompact.h" #include "../TranslationModel/ProbingPT.h" #include "../TranslationModel/UnknownWordPenalty.h" #include "../TranslationModel/Transliteration.h" @@ -51,6 +52,7 @@ FeatureRegistry::FeatureRegistry() // Feature with different name than class. #define MOSES_FNAME2(name, type) Add(name, new DefaultFeatureFactory< type >()); + MOSES_FNAME2("PhraseDictionaryCompact", PhraseTableCompact); MOSES_FNAME2("PhraseDictionaryMemory", PhraseTableMemory); MOSES_FNAME(ProbingPT); MOSES_FNAME2("PhraseDictionaryTransliteration", Transliteration); diff --git a/contrib/moses2/Jamfile b/contrib/moses2/Jamfile index ed74865ee..e4346379e 100644 --- a/contrib/moses2/Jamfile +++ b/contrib/moses2/Jamfile @@ -54,10 +54,11 @@ alias deps : ../..//z ../..//boost_iostreams ../..//boost_filesystem ../../mose LM/KENLMBatch.cpp LM/GPULM.cpp - TranslationModel/PhraseTable.cpp - TranslationModel/ProbingPT.cpp - TranslationModel/Transliteration.cpp - TranslationModel/UnknownWordPenalty.cpp + TranslationModel/PhraseTable.cpp + TranslationModel/PhraseTableCompact.cpp + TranslationModel/ProbingPT.cpp + TranslationModel/Transliteration.cpp + TranslationModel/UnknownWordPenalty.cpp TranslationModel/Memory/PhraseTableMemory.cpp parameters/AllOptions.cpp diff --git a/contrib/moses2/TranslationModel/PhraseTableCompact.cpp b/contrib/moses2/TranslationModel/PhraseTableCompact.cpp new file mode 100644 index 000000000..b7cadb9b1 --- /dev/null +++ b/contrib/moses2/TranslationModel/PhraseTableCompact.cpp @@ -0,0 +1,62 @@ +#include "PhraseTableCompact.h" + +namespace Moses2 +{ +PhraseTableCompact::PhraseTableCompact(size_t startInd, const std::string &line) +:PhraseTable(startInd, line) +{ + ReadParameters(); +} + +PhraseTableCompact::~PhraseTableCompact() +{ + +} + +void PhraseTableCompact::Load(System &system) +{ + +} + +void PhraseTableCompact::SetParameter(const std::string& key, const std::string& value) +{ + if (key == "blah") { + + } + else { + PhraseTable::SetParameter(key, value); + } +} + +// scfg +void PhraseTableCompact::InitActiveChart( + MemPool &pool, + const SCFG::Manager &mgr, + SCFG::InputPath &path) const +{ + UTIL_THROW2("Not implemented"); +} + +void PhraseTableCompact::Lookup( + MemPool &pool, + const SCFG::Manager &mgr, + size_t maxChartSpan, + const SCFG::Stacks &stacks, + SCFG::InputPath &path) const +{ + UTIL_THROW2("Not implemented"); +} + +void PhraseTableCompact::LookupGivenNode( + MemPool &pool, + const SCFG::Manager &mgr, + const SCFG::ActiveChartEntry &prevEntry, + const SCFG::Word &wordSought, + const Moses2::Hypotheses *hypos, + const Moses2::Range &subPhraseRange, + SCFG::InputPath &outPath) const +{ + UTIL_THROW2("Not implemented"); +} + +} diff --git a/contrib/moses2/TranslationModel/PhraseTableCompact.h b/contrib/moses2/TranslationModel/PhraseTableCompact.h new file mode 100644 index 000000000..2333c6eec --- /dev/null +++ b/contrib/moses2/TranslationModel/PhraseTableCompact.h @@ -0,0 +1,40 @@ +#pragma once +#include "PhraseTable.h" + +namespace Moses2 +{ +class PhraseTableCompact: public PhraseTable +{ +public: + PhraseTableCompact(size_t startInd, const std::string &line); + virtual ~PhraseTableCompact(); + void Load(System &system); + virtual void SetParameter(const std::string& key, const std::string& value); + + + // scfg + virtual void InitActiveChart( + MemPool &pool, + const SCFG::Manager &mgr, + SCFG::InputPath &path) const; + + virtual void Lookup( + MemPool &pool, + const SCFG::Manager &mgr, + size_t maxChartSpan, + const SCFG::Stacks &stacks, + SCFG::InputPath &path) const; + +protected: + virtual void LookupGivenNode( + MemPool &pool, + const SCFG::Manager &mgr, + const SCFG::ActiveChartEntry &prevEntry, + const SCFG::Word &wordSought, + const Moses2::Hypotheses *hypos, + const Moses2::Range &subPhraseRange, + SCFG::InputPath &outPath) const; + +}; + +} |