mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 19:27:11 +03:00
error message
This commit is contained in:
parent
74194d9d90
commit
3aa77c1786
@ -64,7 +64,7 @@ int main(int argc, char* argv[])
|
||||
<< toksAlign.size() << " " << lineAlign << endl;
|
||||
*/
|
||||
|
||||
extractSingleton.Process(toksTarget, toksSource, toksAlign);
|
||||
extractSingleton.Process(toksTarget, toksSource, toksAlign, lineCount);
|
||||
|
||||
++lineCount;
|
||||
}
|
||||
@ -86,7 +86,7 @@ const std::string *Vocab::GetOrAdd(const std::string &word)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void ExtractLex::Process(vector<string> &toksTarget, vector<string> &toksSource, vector<string> &toksAlign)
|
||||
void ExtractLex::Process(vector<string> &toksTarget, vector<string> &toksSource, vector<string> &toksAlign, size_t lineCount)
|
||||
{
|
||||
std::vector<bool> m_sourceAligned(toksSource.size(), false)
|
||||
, m_targetAligned(toksTarget.size(), false);
|
||||
@ -99,6 +99,18 @@ void ExtractLex::Process(vector<string> &toksTarget, vector<string> &toksSource,
|
||||
vector<size_t> alignPos;
|
||||
Tokenize(alignPos, alignTok, "-");
|
||||
assert(alignPos.size() == 2);
|
||||
|
||||
if (alignPos[0] >= toksSource.size())
|
||||
{
|
||||
cerr << "ERROR: alignment over source length. Alignment " << alignPos[0] << " at line " << lineCount << endl;
|
||||
continue;
|
||||
}
|
||||
if (alignPos[1] >= toksTarget.size())
|
||||
{
|
||||
cerr << "ERROR: alignment over target length. Alignment " << alignPos[1] << " at line " << lineCount << endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
assert(alignPos[0] < toksSource.size());
|
||||
assert(alignPos[1] < toksTarget.size());
|
||||
|
||||
|
@ -110,7 +110,7 @@ class ExtractLex
|
||||
void Output(const std::map<const std::string*, WordCount> &coll, std::ofstream &outStream);
|
||||
|
||||
public:
|
||||
void Process(std::vector<std::string> &toksTarget, std::vector<std::string> &toksSource, std::vector<std::string> &toksAlign);
|
||||
void Process(std::vector<std::string> &toksTarget, std::vector<std::string> &toksSource, std::vector<std::string> &toksAlign, size_t lineCount);
|
||||
void Output(std::ofstream &streamLexS2T, std::ofstream &streamLexT2S);
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user