diff options
author | Hieu Hoang <hieuhoang@Hieus-MacBook.local> | 2011-11-06 12:35:05 +0400 |
---|---|---|
committer | Hieu Hoang <hieuhoang@Hieus-MacBook.local> | 2011-11-06 12:35:05 +0400 |
commit | 86b9bf8bedf9a5642ec4a253b70fdbe917524f8f (patch) | |
tree | 1327d1844f53f44b7feaeb04755cad11ce1ebffb /moses | |
parent | 311b5a6244a31a5ea9b482d46148f0ec9f67ac0e (diff) |
load hiero format for reading suffix arrays
Diffstat (limited to 'moses')
-rw-r--r-- | moses/src/PhraseDictionary.cpp | 19 | ||||
-rw-r--r-- | moses/src/PhraseDictionaryALSuffixArray.h | 5 |
2 files changed, 22 insertions, 2 deletions
diff --git a/moses/src/PhraseDictionary.cpp b/moses/src/PhraseDictionary.cpp index bec4b70b6..7d6ea8d3d 100644 --- a/moses/src/PhraseDictionary.cpp +++ b/moses/src/PhraseDictionary.cpp @@ -25,6 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #include "PhraseDictionarySCFG.h" #include "PhraseDictionaryOnDisk.h" #include "PhraseDictionaryHiero.h" +#include "PhraseDictionaryALSuffixArray.h" #ifndef WIN32 #include "PhraseDictionaryDynSuffixArray.h" #endif @@ -146,6 +147,24 @@ PhraseDictionary* PhraseDictionaryFeature::LoadPhraseTable(const TranslationSyst , system->GetWordPenaltyProducer()); assert(ret); return pdm; + } else if (m_implementation == ALSuffixArray) { + // memory phrase table + VERBOSE(2,"using Hiero format phrase tables" << std::endl); + if (!FileExists(m_filePath) && FileExists(m_filePath + ".gz")) { + m_filePath += ".gz"; + VERBOSE(2,"Using gzipped file" << std::endl); + } + + PhraseDictionaryALSuffixArray* pdm = new PhraseDictionaryALSuffixArray(m_numScoreComponent,this); + bool ret = pdm->Load(GetInput() + , GetOutput() + , m_filePath + , m_weight + , m_tableLimit + , system->GetLanguageModels() + , system->GetWordPenaltyProducer()); + assert(ret); + return pdm; } else if (m_implementation == OnDisk) { PhraseDictionaryOnDisk* pdta = new PhraseDictionaryOnDisk(m_numScoreComponent, this); diff --git a/moses/src/PhraseDictionaryALSuffixArray.h b/moses/src/PhraseDictionaryALSuffixArray.h index 292af8321..c535e2342 100644 --- a/moses/src/PhraseDictionaryALSuffixArray.h +++ b/moses/src/PhraseDictionaryALSuffixArray.h @@ -16,9 +16,10 @@ namespace Moses { class PhraseDictionaryALSuffixArray : public PhraseDictionaryHiero { public: - PhraseDictionaryHiero(size_t numScoreComponent, PhraseDictionaryFeature* feature) + PhraseDictionaryALSuffixArray(size_t numScoreComponent, PhraseDictionaryFeature* feature) : PhraseDictionaryHiero(numScoreComponent,feature) {} -} +}; + } |