mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-26 21:42:19 +03:00
Check factor is not null before outputting
This commit is contained in:
parent
b46107231d
commit
22ca90bd8a
@ -159,9 +159,12 @@ void OutputSurface(std::ostream &out, const Phrase &phrase, const std::vector<Fa
|
||||
for (size_t pos = 0 ; pos < size ; pos++) {
|
||||
const Factor *factor = phrase.GetFactor(pos, outputFactorOrder[0]);
|
||||
out << *factor;
|
||||
CHECK(factor);
|
||||
|
||||
for (size_t i = 1 ; i < outputFactorOrder.size() ; i++) {
|
||||
const Factor *factor = phrase.GetFactor(pos, outputFactorOrder[i]);
|
||||
CHECK(factor);
|
||||
|
||||
out << "|" << *factor;
|
||||
}
|
||||
out << " ";
|
||||
@ -203,6 +206,8 @@ void IOWrapper::OutputBestHypo(const std::vector<const Factor*>& mbrBestHypo, l
|
||||
{
|
||||
for (size_t i = 0 ; i < mbrBestHypo.size() ; i++) {
|
||||
const Factor *factor = mbrBestHypo[i];
|
||||
CHECK(factor);
|
||||
|
||||
cout << *factor << " ";
|
||||
}
|
||||
}
|
||||
|
@ -198,9 +198,12 @@ void OutputSurface(std::ostream &out, const Hypothesis &edge, const std::vector<
|
||||
for (size_t pos = 0 ; pos < size ; pos++) {
|
||||
const Factor *factor = phrase.GetFactor(pos, outputFactorOrder[0]);
|
||||
out << *factor;
|
||||
CHECK(factor);
|
||||
|
||||
for (size_t i = 1 ; i < outputFactorOrder.size() ; i++) {
|
||||
const Factor *factor = phrase.GetFactor(pos, outputFactorOrder[i]);
|
||||
CHECK(factor);
|
||||
|
||||
out << "|" << *factor;
|
||||
}
|
||||
out << " ";
|
||||
@ -307,6 +310,7 @@ void OutputBestHypo(const std::vector<Word>& mbrBestHypo, long /*translationId*
|
||||
|
||||
for (size_t i = 0 ; i < mbrBestHypo.size() ; i++) {
|
||||
const Factor *factor = mbrBestHypo[i].GetFactor(StaticData::Instance().GetOutputFactorOrder()[0]);
|
||||
CHECK(factor);
|
||||
if (i>0) out << " " << *factor;
|
||||
else out << *factor;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user