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-21 18:55:41 +0400
committerHieu Hoang <hieuhoang@gmail.com>2013-11-21 18:55:41 +0400
commit3c0eaac9a39a1b4395176799c7619ad1e9e95e6c (patch)
treebaa9aa28cd5033cdd103a64bf365f6ece7cf5d59 /moses/BitmapContainer.cpp
parent8381f0c95c6af9a0b6e67740eb8dcbabf8ccf62e (diff)
replace CHECK with UTIL_THROW_IF in Moses
Diffstat (limited to 'moses/BitmapContainer.cpp')
-rw-r--r--moses/BitmapContainer.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/moses/BitmapContainer.cpp b/moses/BitmapContainer.cpp
index 5a90b8a74..d5a8c2a53 100644
--- a/moses/BitmapContainer.cpp
+++ b/moses/BitmapContainer.cpp
@@ -57,7 +57,7 @@ public:
const WordsRange* m_transOptRange;
bool operator()(const Hypothesis* hypoA, const Hypothesis* hypoB) const {
- CHECK(m_transOptRange != NULL);
+ UTIL_THROW_IF2(m_transOptRange == NULL, "Words range not set");
const StaticData &staticData = StaticData::Instance();
@@ -160,11 +160,13 @@ BackwardsEdge::BackwardsEdge(const BitmapContainer &prevBitmapContainer
}
if (m_translations.size() > 1) {
- CHECK(m_translations.Get(0)->GetFutureScore() >= m_translations.Get(1)->GetFutureScore());
+ UTIL_THROW_IF2(m_translations.Get(0)->GetFutureScore() < m_translations.Get(1)->GetFutureScore(),
+ "Non-monotonic future score");
}
if (m_hypotheses.size() > 1) {
- CHECK(m_hypotheses[0]->GetTotalScore() >= m_hypotheses[1]->GetTotalScore());
+ UTIL_THROW_IF2(m_hypotheses[0]->GetTotalScore() < m_hypotheses[1]->GetTotalScore(),
+ "Non-monotonic total score");
}
HypothesisScoreOrdererWithDistortion orderer (&transOptRange);
@@ -213,8 +215,8 @@ BackwardsEdge::SeenPosition(const size_t x, const size_t y)
void
BackwardsEdge::SetSeenPosition(const size_t x, const size_t y)
{
- CHECK(x < (1<<17));
- CHECK(y < (1<<17));
+ UTIL_THROW_IF2(x >= (1<<17), "Error");
+ UTIL_THROW_IF2(y >= (1<<17), "Error");
m_seenPosition.insert((x<<16) + y);
}
@@ -378,7 +380,7 @@ BitmapContainer::AddHypothesis(Hypothesis *hypothesis)
++iter;
}
- CHECK(itemExists == false);
+ UTIL_THROW_IF2(itemExists, "Duplicate hypotheses");
m_hypotheses.push_back(hypothesis);
}
@@ -421,12 +423,13 @@ BitmapContainer::ProcessBestHypothesis()
HypothesisQueueItem *item = Dequeue();
// If the priority queue is exhausted, we are done and should have exited
- CHECK(item != NULL);
+ UTIL_THROW_IF2(item == NULL, "Null object");
// check we are pulling things off of priority queue in right order
if (!Empty()) {
HypothesisQueueItem *check = Dequeue(true);
- CHECK(item->GetHypothesis()->GetTotalScore() >= check->GetHypothesis()->GetTotalScore());
+ UTIL_THROW_IF2(item->GetHypothesis()->GetTotalScore() < check->GetHypothesis()->GetTotalScore(),
+ "Non-monotonic total score");
}
// Logging for the criminally insane