diff options
author | Hieu Hoang <hieu@hoang.co.uk> | 2013-05-29 21:16:15 +0400 |
---|---|---|
committer | Hieu Hoang <hieu@hoang.co.uk> | 2013-05-29 21:16:15 +0400 |
commit | 6249432407af8730c10bccc7894c0725fcaf5e47 (patch) | |
tree | 3ac1f094b9fdc199b04bc5ef209ce00e3596e37d /moses/Phrase.cpp | |
parent | 59bd7deb4b6b9c4f7b3b7dbb055783528fbc31ca (diff) |
beautify
Diffstat (limited to 'moses/Phrase.cpp')
-rw-r--r-- | moses/Phrase.cpp | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/moses/Phrase.cpp b/moses/Phrase.cpp index ef5d09b23..3fa607fb4 100644 --- a/moses/Phrase.cpp +++ b/moses/Phrase.cpp @@ -103,16 +103,15 @@ Phrase Phrase::GetSubString(const WordsRange &wordsRange) const Phrase Phrase::GetSubString(const WordsRange &wordsRange, FactorType factorType) const { - Phrase retPhrase(wordsRange.GetNumWordsCovered()); + Phrase retPhrase(wordsRange.GetNumWordsCovered()); - for (size_t currPos = wordsRange.GetStartPos() ; currPos <= wordsRange.GetEndPos() ; currPos++) - { - const Factor* f = GetFactor(currPos, factorType); - Word &word = retPhrase.AddWord(); - word.SetFactor(factorType, f); - } + for (size_t currPos = wordsRange.GetStartPos() ; currPos <= wordsRange.GetEndPos() ; currPos++) { + const Factor* f = GetFactor(currPos, factorType); + Word &word = retPhrase.AddWord(); + word.SetFactor(factorType, f); + } - return retPhrase; + return retPhrase; } std::string Phrase::GetStringRep(const vector<FactorType> factorsToPrint) const @@ -153,10 +152,10 @@ void Phrase::PrependWord(const Word &newWord) } void Phrase::CreateFromString(FactorDirection direction - ,const std::vector<FactorType> &factorOrder - ,const StringPiece &phraseString - ,const StringPiece &factorDelimiter - ,Word **lhs) + ,const std::vector<FactorType> &factorOrder + ,const StringPiece &phraseString + ,const StringPiece &factorDelimiter + ,Word **lhs) { // parse vector<StringPiece> annotatedWordVector; @@ -165,9 +164,9 @@ void Phrase::CreateFromString(FactorDirection direction } if (annotatedWordVector.size() == 0) { - if (lhs) { - (*lhs) = NULL; - } + if (lhs) { + (*lhs) = NULL; + } return; } @@ -188,8 +187,7 @@ void Phrase::CreateFromString(FactorDirection direction (*lhs) = new Word(true); (*lhs)->CreateFromString(direction, factorOrder, annotatedWord.substr(1, annotatedWord.size() - 2), true); assert((*lhs)->IsNonTerminal()); - } - else { + } else { numWords = annotatedWordVector.size(); //CHECK(lhs == NULL); if (lhs) { |