diff options
author | Hieu Hoang <hieu@hoang.co.uk> | 2013-09-27 12:35:24 +0400 |
---|---|---|
committer | Hieu Hoang <hieu@hoang.co.uk> | 2013-09-27 12:35:24 +0400 |
commit | 31ce9b510e9a06e998ddddfbe92f0192cf7656b8 (patch) | |
tree | 3bfd084ffb9eb72abe1a560cee0be3b5dc0ace7b /moses/Phrase.cpp | |
parent | 13e1adf0002c00b84ff9735d5afddb7e0b73530e (diff) |
beautify
Diffstat (limited to 'moses/Phrase.cpp')
-rw-r--r-- | moses/Phrase.cpp | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/moses/Phrase.cpp b/moses/Phrase.cpp index 025702192..91e41cf2f 100644 --- a/moses/Phrase.cpp +++ b/moses/Phrase.cpp @@ -120,9 +120,9 @@ std::string Phrase::GetStringRep(const vector<FactorType> factorsToPrint) const stringstream strme; for (size_t pos = 0 ; pos < GetSize() ; pos++) { - if(markUnknown && GetWord(pos).IsOOV()) { - strme << "UNK"; - } + if(markUnknown && GetWord(pos).IsOOV()) { + strme << "UNK"; + } strme << GetWord(pos).GetString(factorsToPrint, (pos != GetSize()-1)); } @@ -388,25 +388,23 @@ size_t Phrase::Find(const Phrase &sought, int maxUnknown) const for (soughtPos = 0; soughtPos < sought.GetSize(); ++soughtPos) { const Word &soughtWord = sought.GetWord(soughtPos); const Word &thisWord = GetWord(thisPos); - + if (soughtWord == thisWord) { - ++thisPos; - } - else if (soughtWord.IsOOV() && (maxUnknown < 0 || currUnknowns < maxUnknown)) { - // the output has an OOV word. Allow a certain number of OOVs - ++currUnknowns; - ++thisPos; - } - else { - break; + ++thisPos; + } else if (soughtWord.IsOOV() && (maxUnknown < 0 || currUnknowns < maxUnknown)) { + // the output has an OOV word. Allow a certain number of OOVs + ++currUnknowns; + ++thisPos; + } else { + break; } } - + if (soughtPos == sought.GetSize()) { return startThisPos; } } - + return NOT_FOUND; } |