Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHieu Hoang <hieuhoang@gmail.com>2013-11-19 17:19:23 +0400
committerHieu Hoang <hieuhoang@gmail.com>2013-11-19 17:19:23 +0400
commitc2c86ce50d1900db55e420dd08f38facfce50501 (patch)
tree85ca7cb5d2445dd60cd96325945e14a9626c50b7 /moses/HypothesisStackCubePruning.cpp
parent90d115496515c7f6e1383c19694bb91e21fdcbe9 (diff)
replace CHECK with UTIL_THROW_IF in Moses
Diffstat (limited to 'moses/HypothesisStackCubePruning.cpp')
-rw-r--r--moses/HypothesisStackCubePruning.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/moses/HypothesisStackCubePruning.cpp b/moses/HypothesisStackCubePruning.cpp
index 8929c974e..60a1ff2e6 100644
--- a/moses/HypothesisStackCubePruning.cpp
+++ b/moses/HypothesisStackCubePruning.cpp
@@ -27,6 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include "Util.h"
#include "StaticData.h"
#include "Manager.h"
+#include "util/exception.hh"
using namespace std;
@@ -105,8 +106,8 @@ bool HypothesisStackCubePruning::AddPrune(Hypothesis *hypo)
// equiv hypo exists, recombine with other hypo
iterator &iterExisting = addRet.first;
+ assert(iterExisting != m_hypos.end());
Hypothesis *hypoExisting = *iterExisting;
- CHECK(iterExisting != m_hypos.end());
m_manager.GetSentenceStats().AddRecombination(*hypo, **iterExisting);
@@ -125,8 +126,7 @@ bool HypothesisStackCubePruning::AddPrune(Hypothesis *hypo)
bool added = Add(hypo).second;
if (!added) {
iterExisting = m_hypos.find(hypo);
- TRACE_ERR("Offending hypo = " << **iterExisting << endl);
- CHECK(false);
+ UTIL_THROW(util::Exception, "Should have added hypothesis " << **iterExisting);
}
return false;
} else {
@@ -144,7 +144,8 @@ bool HypothesisStackCubePruning::AddPrune(Hypothesis *hypo)
void HypothesisStackCubePruning::AddInitial(Hypothesis *hypo)
{
std::pair<iterator, bool> addRet = Add(hypo);
- CHECK(addRet.second);
+ UTIL_THROW_IF(!addRet.second, util::Exception,
+ "Should have added hypothesis " << *hypo);
const WordsBitmap &bitmap = hypo->GetWordsBitmap();
m_bitmapAccessor[bitmap] = new BitmapContainer(bitmap, *this);