error in constrained decoding

This commit is contained in:
Hieu Hoang 2014-04-03 18:01:52 +01:00
parent 7e7cc64c1d
commit 5c633fcbf8
2 changed files with 5 additions and 1 deletions

View File

@ -106,7 +106,6 @@ FFState* ConstrainedDecoding::Evaluate(
ConstrainedDecodingState *ret = new ConstrainedDecodingState(hypo);
const Phrase &outputPhrase = ret->GetPhrase();
size_t searchPos = ref->Find(outputPhrase, m_maxUnknowns);
float score;

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;