diff options
author | Hieu Hoang <hieuhoang@gmail.com> | 2015-01-07 14:33:42 +0300 |
---|---|---|
committer | Hieu Hoang <hieuhoang@gmail.com> | 2015-01-07 14:33:42 +0300 |
commit | ff7fbd55ee7105e2d4930336b236744c708003b6 (patch) | |
tree | 17fcafef1faf038a60b08a74c6076cfbeb3dd560 | |
parent | 99b4b63c0cd857185cf2d99972d1150a8b2faf7f (diff) |
add oovpt
-rw-r--r-- | moses/StaticData.cpp | 2 | ||||
-rw-r--r-- | moses/TranslationModel/PhraseDictionary.cpp | 17 | ||||
-rw-r--r-- | moses/TranslationModel/PhraseDictionary.h | 2 |
3 files changed, 20 insertions, 1 deletions
diff --git a/moses/StaticData.cpp b/moses/StaticData.cpp index 52c8099d8..5b4aa5d87 100644 --- a/moses/StaticData.cpp +++ b/moses/StaticData.cpp @@ -635,7 +635,7 @@ void StaticData::LoadDecodeGraphs() void StaticData::LoadDecodeGraphsOld(const vector<string> &mappingVector, const vector<size_t> &maxChartSpans) { - const vector<PhraseDictionary*>& pts = PhraseDictionary::GetColl(); + const vector<PhraseDictionary*>& pts = PhraseDictionary::GetCollExclOOVPt(); const vector<GenerationDictionary*>& gens = GenerationDictionary::GetColl(); const std::vector<FeatureFunction*> *featuresRemaining = &FeatureFunction::GetFeatureFunctions(); diff --git a/moses/TranslationModel/PhraseDictionary.cpp b/moses/TranslationModel/PhraseDictionary.cpp index f1acb9688..c6cc00ef9 100644 --- a/moses/TranslationModel/PhraseDictionary.cpp +++ b/moses/TranslationModel/PhraseDictionary.cpp @@ -28,6 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #include "moses/DecodeGraph.h" #include "moses/InputPath.h" #include "util/exception.hh" +#include "OOVPT.h" using namespace std; @@ -44,6 +45,22 @@ CacheColl::~CacheColl() } } +std::vector<PhraseDictionary*> PhraseDictionary::GetCollExclOOVPt() +{ + std::vector<PhraseDictionary*> ret = GetColl(); + std::vector<PhraseDictionary*>::iterator iter; + + for (iter = ret.begin(); iter != ret.end(); ++iter) { + PhraseDictionary *pt = *iter; + if (typeid(*pt) == typeid(OOVPT&)) { + ret.erase(iter); + break; + } + } + + return ret; +} + PhraseDictionary::PhraseDictionary(const std::string &line) :DecodeFeature(line) ,m_tableLimit(20) // default diff --git a/moses/TranslationModel/PhraseDictionary.h b/moses/TranslationModel/PhraseDictionary.h index f1b938db0..0904fa697 100644 --- a/moses/TranslationModel/PhraseDictionary.h +++ b/moses/TranslationModel/PhraseDictionary.h @@ -77,6 +77,8 @@ public: return s_staticColl; } + static std::vector<PhraseDictionary*> GetCollExclOOVPt(); + PhraseDictionary(const std::string &line); virtual ~PhraseDictionary() { |