check that there's no epsilon

This commit is contained in:
Hieu Hoang 2013-10-04 14:18:11 +01:00
parent a0b6c381e0
commit 01a99d5821
3 changed files with 12 additions and 0 deletions

View File

@ -42,6 +42,8 @@ TranslationOptionCollectionLattice::TranslationOptionCollectionLattice(
const ConfusionNet::Column &col = input.GetColumn(startPos);
for (size_t i = 0; i < col.size(); ++i) {
const Word &word = col[i].first;
CHECK(!word.IsEpsilon());
Phrase subphrase;
subphrase.AddWord(word);

View File

@ -139,6 +139,14 @@ void Word::OnlyTheseFactors(const FactorMask &factors)
}
}
bool Word::IsEpsilon() const
{
const Factor *factor = m_factorArray[0];
int compare = factor->GetString().compare(EPSILON);
return compare == 0;
}
TO_STRING_BODY(Word);
// friend

View File

@ -103,6 +103,8 @@ public:
m_isOOV = val;
}
bool IsEpsilon() const;
/** add the factors from sourceWord into this representation,
* NULL elements in sourceWord will be skipped */
void Merge(const Word &sourceWord);