diff options
author | Hieu Hoang <hieu@hoang.co.uk> | 2013-11-23 00:27:46 +0400 |
---|---|---|
committer | Hieu Hoang <hieu@hoang.co.uk> | 2013-11-23 00:27:46 +0400 |
commit | f13d0c824456b91fef2588261cbe52ce24c665ba (patch) | |
tree | 4c24ab4dff0c05840bcea2333ac522d9b956f7cf /moses-cmd | |
parent | 028edf85501013ea06d575c67b5647f939f1f149 (diff) |
UTIL_THROW_IF -> UTIL_THROW_IF2
Diffstat (limited to 'moses-cmd')
-rw-r--r-- | moses-cmd/IOWrapper.cpp | 15 | ||||
-rw-r--r-- | moses-cmd/LatticeMBRGrid.cpp | 3 |
2 files changed, 6 insertions, 12 deletions
diff --git a/moses-cmd/IOWrapper.cpp b/moses-cmd/IOWrapper.cpp index b0a97fd85..da2589acd 100644 --- a/moses-cmd/IOWrapper.cpp +++ b/moses-cmd/IOWrapper.cpp @@ -207,8 +207,7 @@ std::map<size_t, const Factor*> GetPlaceholders(const Hypothesis &hypo, FactorTy const Factor *factor = inputPhrase.GetFactor(sourcePos, placeholderFactor); if (factor) { std::set<size_t> targetPos = hypo.GetTranslationOption().GetTargetPhrase().GetAlignTerm().GetAlignmentsForSource(sourcePos); - UTIL_THROW_IF(targetPos.size() != 1, - util::Exception, + UTIL_THROW_IF2(targetPos.size() != 1, "Placeholder should be aligned to 1, and only 1, word"); ret[*targetPos.begin()] = factor; } @@ -223,8 +222,7 @@ std::map<size_t, const Factor*> GetPlaceholders(const Hypothesis &hypo, FactorTy void OutputSurface(std::ostream &out, const Hypothesis &edge, const std::vector<FactorType> &outputFactorOrder, char reportSegmentation, bool reportAllFactors) { - UTIL_THROW_IF(outputFactorOrder.size() == 0, - util::Exception, + UTIL_THROW_IF2(outputFactorOrder.size() == 0, "Must specific at least 1 output factor"); const TargetPhrase& phrase = edge.GetCurrTargetPhrase(); bool markUnknown = StaticData::Instance().GetMarkUnknown(); @@ -251,8 +249,7 @@ void OutputSurface(std::ostream &out, const Hypothesis &edge, const std::vector< } } - UTIL_THROW_IF(factor == NULL, - util::Exception, + UTIL_THROW_IF2(factor == NULL, "No factor 0 at position " << pos); //preface surface form with UNK if marking unknowns @@ -265,8 +262,7 @@ void OutputSurface(std::ostream &out, const Hypothesis &edge, const std::vector< for (size_t i = 1 ; i < outputFactorOrder.size() ; i++) { const Factor *factor = phrase.GetFactor(pos, outputFactorOrder[i]); - UTIL_THROW_IF(factor == NULL, - util::Exception, + UTIL_THROW_IF2(factor == NULL, "No factor " << i << " at position " << pos); out << "|" << *factor; @@ -402,8 +398,7 @@ void OutputBestHypo(const std::vector<Word>& mbrBestHypo, long /*translationId* for (size_t i = 0 ; i < mbrBestHypo.size() ; i++) { const Factor *factor = mbrBestHypo[i].GetFactor(StaticData::Instance().GetOutputFactorOrder()[0]); - UTIL_THROW_IF(factor == NULL, - util::Exception, + UTIL_THROW_IF2(factor == NULL, "No factor 0 at position " << i); if (i>0) out << " " << *factor; else out << *factor; diff --git a/moses-cmd/LatticeMBRGrid.cpp b/moses-cmd/LatticeMBRGrid.cpp index 41a1377ad..4c6b421fc 100644 --- a/moses-cmd/LatticeMBRGrid.cpp +++ b/moses-cmd/LatticeMBRGrid.cpp @@ -69,8 +69,7 @@ public: /** Add a parameter with key, command line argument, and default value */ void addParam(gridkey key, const string& arg, float defaultValue) { m_args[arg] = key; - UTIL_THROW_IF(m_grid.find(key) != m_grid.end(), - util::Exception, + UTIL_THROW_IF2(m_grid.find(key) != m_grid.end(), "Couldn't find value for key " << (int) key); m_grid[key].push_back(defaultValue); } |