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-20 15:59:36 +0400
committerHieu Hoang <hieuhoang@gmail.com>2013-11-20 15:59:36 +0400
commita77e928628caa7d0c6fdab66493c7891def9ee16 (patch)
tree641087cf9231e7d558c36af43d908dd455872d19 /moses/TranslationOptionCollectionConfusionNet.cpp
parentc2ffc022eab102fc2e1593c435c1eaa389583278 (diff)
replace CHECK with UTIL_THROW_IF in Moses
Diffstat (limited to 'moses/TranslationOptionCollectionConfusionNet.cpp')
-rw-r--r--moses/TranslationOptionCollectionConfusionNet.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/moses/TranslationOptionCollectionConfusionNet.cpp b/moses/TranslationOptionCollectionConfusionNet.cpp
index 6fe0bf914..95a90760d 100644
--- a/moses/TranslationOptionCollectionConfusionNet.cpp
+++ b/moses/TranslationOptionCollectionConfusionNet.cpp
@@ -9,6 +9,7 @@
#include "FactorCollection.h"
#include "FF/InputFeature.h"
#include "TranslationModel/PhraseDictionaryTreeAdaptor.h"
+#include "util/exception.hh"
using namespace std;
@@ -22,7 +23,8 @@ TranslationOptionCollectionConfusionNet::TranslationOptionCollectionConfusionNet
: TranslationOptionCollection(input, maxNoTransOptPerCoverage, translationOptionThreshold)
{
const InputFeature *inputFeature = StaticData::Instance().GetInputFeature();
- CHECK(inputFeature);
+ UTIL_THROW_IF(inputFeature == NULL, util::Exception,
+ "Input feature must be specified");
size_t inputSize = input.GetSize();
m_inputPathMatrix.resize(inputSize);
@@ -79,7 +81,8 @@ TranslationOptionCollectionConfusionNet::TranslationOptionCollectionConfusionNet
const Phrase &prevPhrase = prevPath.GetPhrase();
const ScorePair *prevInputScore = prevPath.GetInputScore();
- CHECK(prevInputScore);
+ UTIL_THROW_IF(prevInputScore == NULL, util::Exception,
+ "No input score for path: " << prevPath);
// loop thru every word at this position
const ConfusionNet::Column &col = input.GetColumn(endPos);
@@ -108,7 +111,9 @@ TranslationOptionCollectionConfusionNet::TranslationOptionCollectionConfusionNet
InputPathList &TranslationOptionCollectionConfusionNet::GetInputPathList(size_t startPos, size_t endPos)
{
size_t offset = endPos - startPos;
- CHECK(offset < m_inputPathMatrix[startPos].size());
+ UTIL_THROW_IF(offset >= m_inputPathMatrix[startPos].size(),
+ util::Exception, "Out of bound access: " << offset);
+
return m_inputPathMatrix[startPos][offset];
}
@@ -235,7 +240,7 @@ void TranslationOptionCollectionConfusionNet::CreateTranslationOptionsForRangeLE
, this
, adhereTableLimit);
} else {
- CHECK(genStep);
+ assert(genStep);
genStep->Process(inputPartialTranslOpt
, *decodeStep
, *newPtoc