mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 11:25:40 +03:00
get rid of all aborts from decoder
This commit is contained in:
parent
b5558c36b8
commit
fccf2ea43a
@ -108,8 +108,7 @@ bool ChartHypothesisCollection::AddHypothesis(ChartHypothesis *hypo, ChartManage
|
||||
bool added = Add(hypo, manager).second;
|
||||
if (!added) {
|
||||
iterExisting = m_hypos.find(hypo);
|
||||
TRACE_ERR("Offending hypo = " << **iterExisting << endl);
|
||||
abort();
|
||||
UTIL_THROW2("Offending hypo = " << **iterExisting);
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
|
@ -242,8 +242,7 @@ void ConfusionNet::Print(std::ostream& out) const
|
||||
#endif
|
||||
Phrase ConfusionNet::GetSubString(const WordsRange&) const
|
||||
{
|
||||
TRACE_ERR("ERROR: call to ConfusionNet::GetSubString\n");
|
||||
abort();
|
||||
UTIL_THROW2("ERROR: call to ConfusionNet::GetSubString\n");
|
||||
//return Phrase(Input);
|
||||
}
|
||||
|
||||
@ -257,8 +256,7 @@ std::string ConfusionNet::GetStringRep(const std::vector<FactorType> /* factorsT
|
||||
#endif
|
||||
const Word& ConfusionNet::GetWord(size_t) const
|
||||
{
|
||||
TRACE_ERR("ERROR: call to ConfusionNet::GetFactorArray\n");
|
||||
abort();
|
||||
UTIL_THROW2("ERROR: call to ConfusionNet::GetFactorArray\n");
|
||||
}
|
||||
#ifdef _WIN32
|
||||
#pragma warning(default:4716)
|
||||
|
32
moses/File.h
32
moses/File.h
@ -9,6 +9,7 @@
|
||||
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include "util/exception.hh"
|
||||
#include "UserMessage.h"
|
||||
@ -37,8 +38,7 @@ static const OFF_T InvalidOffT=-1;
|
||||
template<typename T> inline size_t fWrite(FILE* f,const T& t)
|
||||
{
|
||||
if(fwrite(&t,sizeof(t),1,f)!=1) {
|
||||
TRACE_ERR("ERROR:: fwrite!\n");
|
||||
abort();
|
||||
UTIL_THROW2("ERROR:: fwrite!");
|
||||
}
|
||||
return sizeof(t);
|
||||
}
|
||||
@ -46,8 +46,7 @@ template<typename T> inline size_t fWrite(FILE* f,const T& t)
|
||||
template<typename T> inline void fRead(FILE* f,T& t)
|
||||
{
|
||||
if(fread(&t,sizeof(t),1,f)!=1) {
|
||||
TRACE_ERR("ERROR: fread!\n");
|
||||
abort();
|
||||
UTIL_THROW2("ERROR: fread!");
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,8 +55,7 @@ template<typename T> inline size_t fWrite(FILE* f,const T* b,const T* e)
|
||||
UINT32 s=std::distance(b,e);
|
||||
size_t rv=fWrite(f,s);
|
||||
if(fwrite(b,sizeof(T),s,f)!=s) {
|
||||
TRACE_ERR("ERROR: fwrite!\n");
|
||||
abort();
|
||||
UTIL_THROW2("ERROR: fwrite!");
|
||||
}
|
||||
return rv+sizeof(T)*s;
|
||||
}
|
||||
@ -67,8 +65,7 @@ template<typename T> inline size_t fWrite(FILE* f,const T b,const T e)
|
||||
UINT32 s=std::distance(b,e);
|
||||
size_t rv=fWrite(f,s);
|
||||
if(fwrite(&(*b),sizeof(T),s,f)!=s) {
|
||||
TRACE_ERR("ERROR: fwrite!\n");
|
||||
abort();
|
||||
UTIL_THROW2("ERROR: fwrite!");
|
||||
}
|
||||
return rv+sizeof(T)*s;
|
||||
}
|
||||
@ -78,8 +75,7 @@ template<typename C> inline size_t fWriteVector(FILE* f,const C& v)
|
||||
UINT32 s=v.size();
|
||||
size_t rv=fWrite(f,s);
|
||||
if(fwrite(&v[0],sizeof(typename C::value_type),s,f)!=s) {
|
||||
TRACE_ERR("ERROR: fwrite!\n");
|
||||
abort();
|
||||
UTIL_THROW2("ERROR: fwrite!");
|
||||
}
|
||||
return rv+sizeof(typename C::value_type)*s;
|
||||
}
|
||||
@ -91,8 +87,7 @@ template<typename C> inline void fReadVector(FILE* f, C& v)
|
||||
v.resize(s);
|
||||
size_t r=fread(&(*v.begin()),sizeof(typename C::value_type),s,f);
|
||||
if(r!=s) {
|
||||
TRACE_ERR("ERROR: freadVec! "<<r<<" "<<s<<"\n");
|
||||
abort();
|
||||
UTIL_THROW2("ERROR: freadVec! "<<r<<" "<<s);
|
||||
}
|
||||
}
|
||||
|
||||
@ -100,8 +95,7 @@ inline size_t fWriteString(FILE* f,const char* e, UINT32 s)
|
||||
{
|
||||
size_t rv=fWrite(f,s);
|
||||
if(fwrite(e,sizeof(char),s,f)!=s) {
|
||||
TRACE_ERR("ERROR:: fwrite!\n");
|
||||
abort();
|
||||
UTIL_THROW2("ERROR:: fwrite!");
|
||||
}
|
||||
return rv+sizeof(char)*s;
|
||||
}
|
||||
@ -112,8 +106,7 @@ inline void fReadString(FILE* f,std::string& e)
|
||||
fRead(f,s);
|
||||
char* a=new char[s+1];
|
||||
if(fread(a,sizeof(char),s,f)!=s) {
|
||||
TRACE_ERR("ERROR: fread!\n");
|
||||
abort();
|
||||
UTIL_THROW2("ERROR: fread!");
|
||||
}
|
||||
a[s]='\0';
|
||||
e.assign(a);
|
||||
@ -149,9 +142,10 @@ inline OFF_T fTell(FILE* f)
|
||||
inline void fSeek(FILE* f,OFF_T o)
|
||||
{
|
||||
if(FSEEKO(f,o,SEEK_SET)<0) {
|
||||
TRACE_ERR("ERROR: could not fseeko position "<<o<<"\n");
|
||||
if(o==InvalidOffT) TRACE_ERR("You tried to seek for 'InvalidOffT'!\n");
|
||||
abort();
|
||||
std::stringstream strme;
|
||||
strme << "ERROR: could not fseeko position " << o <<"\n";
|
||||
if(o==InvalidOffT) strme << "You tried to seek for 'InvalidOffT'!\n";
|
||||
UTIL_THROW2(strme.str());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -136,8 +136,7 @@ bool HypothesisStackNormal::AddPrune(Hypothesis *hypo)
|
||||
bool added = Add(hypo).second;
|
||||
if (!added) {
|
||||
iterExisting = m_hypos.find(hypo);
|
||||
TRACE_ERR("Offending hypo = " << **iterExisting << endl);
|
||||
abort();
|
||||
UTIL_THROW2("Offending hypo = " << **iterExisting);
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
|
@ -416,7 +416,6 @@ LanguageModel *ConstructKenLM(const std::string &line)
|
||||
|
||||
LanguageModel *ConstructKenLM(const std::string &line, const std::string &file, FactorType factorType, bool lazy)
|
||||
{
|
||||
try {
|
||||
lm::ngram::ModelType model_type;
|
||||
if (lm::ngram::RecognizeBinary(file.c_str(), model_type)) {
|
||||
|
||||
@ -434,16 +433,11 @@ LanguageModel *ConstructKenLM(const std::string &line, const std::string &file,
|
||||
case lm::ngram::QUANT_ARRAY_TRIE:
|
||||
return new LanguageModelKen<lm::ngram::QuantArrayTrieModel>(line, file, factorType, lazy);
|
||||
default:
|
||||
std::cerr << "Unrecognized kenlm model type " << model_type << std::endl;
|
||||
abort();
|
||||
UTIL_THROW2("Unrecognized kenlm model type " << model_type);
|
||||
}
|
||||
} else {
|
||||
return new LanguageModelKen<lm::ngram::ProbingModel>(line, file, factorType, lazy);
|
||||
}
|
||||
} catch (std::exception &e) {
|
||||
std::cerr << e.what() << std::endl;
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -322,14 +322,12 @@ void LanguageModelLDHT::IssueRequestsFor(Hypothesis& hypo,
|
||||
LDHTLMState* new_state = new LDHTLMState();
|
||||
if (input_state == NULL) {
|
||||
if (hypo.GetCurrTargetWordsRange().GetStartPos() != 0) {
|
||||
V("got a null state but not at start of sentence");
|
||||
abort();
|
||||
UTIL_THROW2("got a null state but not at start of sentence");
|
||||
}
|
||||
new_state->gram_fingerprints.appendGram(BOS_);
|
||||
} else {
|
||||
if (hypo.GetCurrTargetWordsRange().GetStartPos() == 0) {
|
||||
V("got a non null state but at start of sentence");
|
||||
abort();
|
||||
UTIL_THROW2("got a non null state but at start of sentence");
|
||||
}
|
||||
new_state->copyFrom(static_cast<const LDHTLMState&>(*input_state));
|
||||
}
|
||||
|
@ -228,8 +228,7 @@ public:
|
||||
|
||||
std::string binFname=filePath+".binphr.idx";
|
||||
if(!FileExists(binFname.c_str())) {
|
||||
UserMessage::Add( "bin ttable does not exist\n");
|
||||
abort();
|
||||
UTIL_THROW2( "bin ttable does not exist");
|
||||
//TRACE_ERR( "bin ttable does not exist -> create it\n");
|
||||
//InputFileStream in(filePath);
|
||||
//m_dict->Create(in,filePath);
|
||||
|
@ -726,7 +726,7 @@ void Parameter::ConvertWeightArgsLM()
|
||||
newFeatureName = "KENLM";
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
UTIL_THROW2("Unkown language model type id:" << lmType);
|
||||
}
|
||||
|
||||
size_t numFF = 1;
|
||||
|
@ -100,11 +100,12 @@ private:
|
||||
static IndexPair GetIndexes(const FeatureFunction* sp) {
|
||||
ScoreIndexMap::const_iterator indexIter = s_scoreIndexes.find(sp);
|
||||
if (indexIter == s_scoreIndexes.end()) {
|
||||
std::cerr << "ERROR: FeatureFunction: " << sp->GetScoreProducerDescription() <<
|
||||
std::stringstream strme;
|
||||
strme << "ERROR: FeatureFunction: " << sp->GetScoreProducerDescription() <<
|
||||
" not registered with ScoreIndexMap" << std::endl;
|
||||
std::cerr << "You must call ScoreComponentCollection.RegisterScoreProducer() " <<
|
||||
strme << "You must call ScoreComponentCollection.RegisterScoreProducer() " <<
|
||||
" for every FeatureFunction" << std::endl;
|
||||
abort();
|
||||
UTIL_THROW2(strme.str());
|
||||
}
|
||||
return indexIter->second;
|
||||
}
|
||||
|
@ -30,8 +30,7 @@ Search *Search::CreateSearch(Manager& manager, const InputType &source,
|
||||
case NormalBatch:
|
||||
return new SearchNormalBatch(manager, source, transOptColl);
|
||||
default:
|
||||
UserMessage::Add("ERROR: search. Aborting\n");
|
||||
abort();
|
||||
UTIL_THROW2("ERROR: search. Aborting\n");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -140,8 +140,7 @@ ExpandHypothesis(const Hypothesis &hypothesis,
|
||||
}
|
||||
m_partial_hypos.push_back(newHypo);
|
||||
} else {
|
||||
std::cerr << "can't use early discarding with batch decoding!" << std::endl;
|
||||
abort();
|
||||
UTIL_THROW2("can't use early discarding with batch decoding!");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -366,10 +366,11 @@ void BlockHashIndex::CalcHash(size_t current, void* source_void)
|
||||
|
||||
if(lastKey > temp) {
|
||||
if(source->nkeys != 2 || temp != "###DUMMY_KEY###") {
|
||||
std::cerr << "ERROR: Input file does not appear to be sorted with LC_ALL=C sort" << std::endl;
|
||||
std::cerr << "1: " << lastKey << std::endl;
|
||||
std::cerr << "2: " << temp << std::endl;
|
||||
abort();
|
||||
std::stringstream strme;
|
||||
strme << "ERROR: Input file does not appear to be sorted with LC_ALL=C sort" << std::endl;
|
||||
strme << "1: " << lastKey << std::endl;
|
||||
strme << "2: " << temp << std::endl;
|
||||
UTIL_THROW2(strme.str());
|
||||
}
|
||||
}
|
||||
lastKey = temp;
|
||||
|
@ -23,6 +23,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#define moses_BlockHashIndex_h
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <queue>
|
||||
@ -140,10 +141,11 @@ public:
|
||||
size_t current = m_landmarks.size();
|
||||
|
||||
if(m_landmarks.size() && m_landmarks.back().str() >= keys[0]) {
|
||||
std::cerr << "ERROR: Input file does not appear to be sorted with LC_ALL=C sort" << std::endl;
|
||||
std::cerr << "1: " << m_landmarks.back().str() << std::endl;
|
||||
std::cerr << "2: " << keys[0] << std::endl;
|
||||
abort();
|
||||
std::stringstream strme;
|
||||
strme << "ERROR: Input file does not appear to be sorted with LC_ALL=C sort" << std::endl;
|
||||
strme << "1: " << m_landmarks.back().str() << std::endl;
|
||||
strme << "2: " << keys[0] << std::endl;
|
||||
UTIL_THROW2(strme.str());
|
||||
}
|
||||
|
||||
m_landmarks.push_back(keys[0]);
|
||||
|
@ -19,6 +19,7 @@ License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
***********************************************************************/
|
||||
|
||||
#include <sstream>
|
||||
#include "LexicalReorderingTableCreator.h"
|
||||
#include "ThrowingFwrite.h"
|
||||
#include "moses/Util.h"
|
||||
@ -203,10 +204,11 @@ std::string LexicalReorderingTableCreator::EncodeLine(std::vector<std::string>&
|
||||
}
|
||||
|
||||
if(m_numScoreComponent != scores.size()) {
|
||||
std::cerr << "Error: Wrong number of scores detected ("
|
||||
std::stringstream strme;
|
||||
strme << "Error: Wrong number of scores detected ("
|
||||
<< scores.size() << " != " << m_numScoreComponent << ") :" << std::endl;
|
||||
std::cerr << "Line: " << tokens[0] << " ||| ... ||| " << scoresString << std::endl;
|
||||
abort();
|
||||
strme << "Line: " << tokens[0] << " ||| ... ||| " << scoresString << std::endl;
|
||||
UTIL_THROW2(strme.str());
|
||||
}
|
||||
|
||||
size_t c = 0;
|
||||
|
@ -714,10 +714,11 @@ std::string PhraseTableCreator::EncodeLine(std::vector<std::string>& tokens, siz
|
||||
std::vector<float> scores = Tokenize<float>(scoresStr);
|
||||
|
||||
if(scores.size() != m_numScoreComponent) {
|
||||
std::cerr << "Error: Wrong number of scores detected ("
|
||||
std::stringstream strme;
|
||||
strme << "Error: Wrong number of scores detected ("
|
||||
<< scores.size() << " != " << m_numScoreComponent << ") :" << std::endl;
|
||||
std::cerr << "Line: " << tokens[0] << " ||| " << tokens[1] << " ||| " << tokens[3] << " ..." << std::endl;
|
||||
abort();
|
||||
strme << "Line: " << tokens[0] << " ||| " << tokens[1] << " ||| " << tokens[3] << " ..." << std::endl;
|
||||
UTIL_THROW2(strme.str());
|
||||
}
|
||||
|
||||
std::set<AlignPoint> a;
|
||||
@ -1039,27 +1040,30 @@ void RankingTask::operator()()
|
||||
*it = Moses::Trim(*it);
|
||||
|
||||
if(tokens.size() < 4) {
|
||||
std::cerr << "Error: It seems the following line has a wrong format:" << std::endl;
|
||||
std::cerr << "Line " << i << ": " << lines[i] << std::endl;
|
||||
abort();
|
||||
std::stringstream strme;
|
||||
strme << "Error: It seems the following line has a wrong format:" << std::endl;
|
||||
strme << "Line " << i << ": " << lines[i] << std::endl;
|
||||
UTIL_THROW2(strme.str());
|
||||
}
|
||||
|
||||
if(tokens[3].size() <= 1 && m_creator.m_coding != PhraseTableCreator::None) {
|
||||
std::cerr << "Error: It seems the following line contains no alignment information, " << std::endl;
|
||||
std::cerr << "but you are using ";
|
||||
std::cerr << (m_creator.m_coding == PhraseTableCreator::PREnc ? "PREnc" : "REnc");
|
||||
std::cerr << " encoding which makes use of alignment data. " << std::endl;
|
||||
std::cerr << "Use -encoding None" << std::endl;
|
||||
std::cerr << "Line " << i << ": " << lines[i] << std::endl;
|
||||
abort();
|
||||
std::stringstream strme;
|
||||
strme << "Error: It seems the following line contains no alignment information, " << std::endl;
|
||||
strme << "but you are using ";
|
||||
strme << (m_creator.m_coding == PhraseTableCreator::PREnc ? "PREnc" : "REnc");
|
||||
strme << " encoding which makes use of alignment data. " << std::endl;
|
||||
strme << "Use -encoding None" << std::endl;
|
||||
strme << "Line " << i << ": " << lines[i] << std::endl;
|
||||
UTIL_THROW2(strme.str());
|
||||
}
|
||||
|
||||
std::vector<float> scores = Tokenize<float>(tokens[2]);
|
||||
if(scores.size() != m_creator.m_numScoreComponent) {
|
||||
std::cerr << "Error: It seems the following line has a wrong number of scores ("
|
||||
std::stringstream strme;
|
||||
strme << "Error: It seems the following line has a wrong number of scores ("
|
||||
<< scores.size() << " != " << m_creator.m_numScoreComponent << ") :" << std::endl;
|
||||
std::cerr << "Line " << i << ": " << lines[i] << std::endl;
|
||||
abort();
|
||||
strme << "Line " << i << ": " << lines[i] << std::endl;
|
||||
UTIL_THROW2(strme.str());
|
||||
}
|
||||
|
||||
float sortScore = scores[m_creator.m_sortScoreIndex];
|
||||
@ -1136,19 +1140,21 @@ void EncodingTask::operator()()
|
||||
*it = Moses::Trim(*it);
|
||||
|
||||
if(tokens.size() < 3) {
|
||||
std::cerr << "Error: It seems the following line has a wrong format:" << std::endl;
|
||||
std::cerr << "Line " << i << ": " << lines[i] << std::endl;
|
||||
abort();
|
||||
std::stringstream strme;
|
||||
strme << "Error: It seems the following line has a wrong format:" << std::endl;
|
||||
strme << "Line " << i << ": " << lines[i] << std::endl;
|
||||
UTIL_THROW2(strme.str());
|
||||
}
|
||||
|
||||
if(tokens[3].size() <= 1 && m_creator.m_coding != PhraseTableCreator::None) {
|
||||
std::cerr << "Error: It seems the following line contains no alignment information, " << std::endl;
|
||||
std::cerr << "but you are using ";
|
||||
std::cerr << (m_creator.m_coding == PhraseTableCreator::PREnc ? "PREnc" : "REnc");
|
||||
std::cerr << " encoding which makes use of alignment data. " << std::endl;
|
||||
std::cerr << "Use -encoding None" << std::endl;
|
||||
std::cerr << "Line " << i << ": " << lines[i] << std::endl;
|
||||
abort();
|
||||
std::stringstream strme;
|
||||
strme << "Error: It seems the following line contains no alignment information, " << std::endl;
|
||||
strme << "but you are using ";
|
||||
strme << (m_creator.m_coding == PhraseTableCreator::PREnc ? "PREnc" : "REnc");
|
||||
strme << " encoding which makes use of alignment data. " << std::endl;
|
||||
strme << "Use -encoding None" << std::endl;
|
||||
strme << "Line " << i << ": " << lines[i] << std::endl;
|
||||
UTIL_THROW2(strme.str());
|
||||
}
|
||||
|
||||
size_t ownRank = 0;
|
||||
|
@ -380,10 +380,8 @@ PhraseDictionaryTree::PhraseDictionaryTree()
|
||||
: imp(new PDTimp)
|
||||
{
|
||||
if(sizeof(OFF_T)!=8) {
|
||||
TRACE_ERR("ERROR: size of type 'OFF_T' has to be 64 bit!\n"
|
||||
"In gcc, use compiler settings '-D_FILE_OFFSET_BITS=64 -D_LARGE_FILES'\n"
|
||||
" -> abort \n\n");
|
||||
abort();
|
||||
UTIL_THROW2("ERROR: size of type 'OFF_T' has to be 64 bit!\n"
|
||||
"In gcc, use compiler settings '-D_FILE_OFFSET_BITS=64 -D_LARGE_FILES'\n");
|
||||
}
|
||||
}
|
||||
|
||||
@ -506,10 +504,7 @@ int PhraseDictionaryTree::Create(std::istream& inFile,const std::string& out)
|
||||
}
|
||||
|
||||
if (tokens.size() != numElement) {
|
||||
std::stringstream strme;
|
||||
strme << "Syntax error at line " << lnc << " : " << line;
|
||||
UserMessage::Add(strme.str());
|
||||
abort();
|
||||
UTIL_THROW2("Syntax error at line " << lnc << " : " << line);
|
||||
}
|
||||
|
||||
const std::string &sourcePhraseString =tokens[0]
|
||||
@ -554,9 +549,8 @@ int PhraseDictionaryTree::Create(std::istream& inFile,const std::string& out)
|
||||
PSA::Data& d=psa->insert(f);
|
||||
if(d==InvalidOffT) d=fTell(ot);
|
||||
else {
|
||||
TRACE_ERR("ERROR: source phrase already inserted (A)!\nline(" << lnc << "): '"
|
||||
<<line<<"'\nf: "<<f<<"\n");
|
||||
abort();
|
||||
UTIL_THROW2("ERROR: source phrase already inserted (A)!\nline(" << lnc << "): '"
|
||||
<<line);
|
||||
}
|
||||
}
|
||||
|
||||
@ -565,9 +559,8 @@ int PhraseDictionaryTree::Create(std::istream& inFile,const std::string& out)
|
||||
if (!sparseFeatureString.empty()) {
|
||||
std::vector<std::string> sparseTokens = Tokenize(sparseFeatureString);
|
||||
if (sparseTokens.size() % 2 != 0) {
|
||||
TRACE_ERR("ERROR: incorrectly formatted sparse feature string: " <<
|
||||
sparseFeatureString << std::endl);
|
||||
abort();
|
||||
UTIL_THROW2("ERROR: incorrectly formatted sparse feature string: " <<
|
||||
sparseFeatureString);
|
||||
}
|
||||
for (size_t i = 0; i < sparseTokens.size(); i+=2) {
|
||||
fnames.push_back(imp->tv.add(sparseTokens[i]));
|
||||
@ -608,9 +601,8 @@ int PhraseDictionaryTree::Create(std::istream& inFile,const std::string& out)
|
||||
PSA::Data& d=psa->insert(f);
|
||||
if(d==InvalidOffT) d=fTell(ot);
|
||||
else {
|
||||
TRACE_ERR("ERROR: xsource phrase already inserted (B)!\nline(" << lnc << "): '"
|
||||
<<line<<"'\nf: "<<f<<"\n");
|
||||
abort();
|
||||
UTIL_THROW2("ERROR: xsource phrase already inserted (B)!\nline(" << lnc << "): '"
|
||||
<<line);
|
||||
}
|
||||
}
|
||||
tgtCands.push_back(TgtCand(e,sc, alignmentString));
|
||||
|
@ -52,10 +52,8 @@ void PhraseDictionaryTreeAdaptor::InitializeForInput(InputType const& source)
|
||||
vector<float> weight = staticData.GetWeights(this);
|
||||
if(m_numScoreComponents!=weight.size()) {
|
||||
std::stringstream strme;
|
||||
strme << "ERROR: mismatch of number of scaling factors: "<<weight.size()
|
||||
<<" "<<m_numScoreComponents<<"\n";
|
||||
UserMessage::Add(strme.str());
|
||||
abort();
|
||||
UTIL_THROW2("ERROR: mismatch of number of scaling factors: " << weight.size()
|
||||
<< " " << m_numScoreComponents);
|
||||
}
|
||||
|
||||
obj->Create(m_input, m_output, m_filePath, weight);
|
||||
|
@ -211,11 +211,8 @@ bool RuleTableLoaderStandard::Load(FormatType format
|
||||
}
|
||||
const size_t numScoreComponents = ruleTable.GetNumScoreComponents();
|
||||
if (scoreVector.size() != numScoreComponents) {
|
||||
stringstream strme;
|
||||
strme << "Size of scoreVector != number (" << scoreVector.size() << "!="
|
||||
<< numScoreComponents << ") of score components on line " << count;
|
||||
UserMessage::Add(strme.str());
|
||||
abort();
|
||||
UTIL_THROW2("Size of scoreVector != number (" << scoreVector.size() << "!="
|
||||
<< numScoreComponents << ") of score components on line " << count);
|
||||
}
|
||||
|
||||
// parse source & find pt node
|
||||
|
@ -200,10 +200,7 @@ void PhraseDictionaryFuzzyMatch::InitializeForInput(InputType const& inputSenten
|
||||
TokenizeMultiCharSeparator(tokens, *line , "|||" );
|
||||
|
||||
if (tokens.size() != 4 && tokens.size() != 5) {
|
||||
stringstream strme;
|
||||
strme << "Syntax error at " << ptFileName << ":" << count;
|
||||
UserMessage::Add(strme.str());
|
||||
abort();
|
||||
UTIL_THROW2("Syntax error at " << ptFileName << ":" << count);
|
||||
}
|
||||
|
||||
const string &sourcePhraseString = tokens[0]
|
||||
@ -220,11 +217,8 @@ void PhraseDictionaryFuzzyMatch::InitializeForInput(InputType const& inputSenten
|
||||
Tokenize<float>(scoreVector, scoreString);
|
||||
const size_t numScoreComponents = GetNumScoreComponents();
|
||||
if (scoreVector.size() != numScoreComponents) {
|
||||
stringstream strme;
|
||||
strme << "Size of scoreVector != number (" << scoreVector.size() << "!="
|
||||
<< numScoreComponents << ") of score components on line " << count;
|
||||
UserMessage::Add(strme.str());
|
||||
abort();
|
||||
UTIL_THROW2("Size of scoreVector != number (" << scoreVector.size() << "!="
|
||||
<< numScoreComponents << ") of score components on line " << count);
|
||||
}
|
||||
|
||||
UTIL_THROW_IF2(scoreVector.size() != numScoreComponents,
|
||||
|
Loading…
Reference in New Issue
Block a user