error in constrained decoding

This commit is contained in:
Hieu Hoang 2014-04-03 18:03:58 +01:00
parent 63ca61ba0b
commit 67b1cbce13

View File

@ -380,6 +380,11 @@ void Phrase::InitStartEndWord()
size_t Phrase::Find(const Phrase &sought, int maxUnknown) const
{
if (GetSize() < sought.GetSize()) {
// sought phrase too big
return NOT_FOUND;
}
size_t maxStartPos = GetSize() - sought.GetSize();
for (size_t startThisPos = 0; startThisPos <= maxStartPos; ++startThisPos) {
size_t thisPos = startThisPos;