diff options
author | Hieu Hoang <hieu@hoang.co.uk> | 2013-03-09 02:04:28 +0400 |
---|---|---|
committer | Hieu Hoang <hieu@hoang.co.uk> | 2013-03-09 02:04:28 +0400 |
commit | 51d34f2f96688edd4f4703a3500011875ff89177 (patch) | |
tree | d3299a13a13f8d096fe2ed24d4775f76f35162c5 /moses/Phrase.cpp | |
parent | a53392165fcee9f33340a7e1e0997c30a11f7618 (diff) |
delete Phrase::CreateFromStringNewFormat()
Diffstat (limited to 'moses/Phrase.cpp')
-rw-r--r-- | moses/Phrase.cpp | 64 |
1 files changed, 0 insertions, 64 deletions
diff --git a/moses/Phrase.cpp b/moses/Phrase.cpp index 5ec03723b..54bd60c3b 100644 --- a/moses/Phrase.cpp +++ b/moses/Phrase.cpp @@ -217,70 +217,6 @@ void Phrase::CreateFromString(FactorDirection direction } } -void Phrase::CreateFromStringNewFormat(FactorDirection direction - , const std::vector<FactorType> &factorOrder - , const StringPiece &phraseString - , const std::string & /*factorDelimiter */ - , Word *lhs) -{ - // parse - vector<StringPiece> annotatedWordVector; - for (util::TokenIter<util::AnyCharacter, true> it(phraseString, "\t "); it; ++it) { - annotatedWordVector.push_back(*it); - } - // KOMMA|none ART|Def.Z NN|Neut.NotGen.Sg VVFIN|none - // to - // "KOMMA|none" "ART|Def.Z" "NN|Neut.NotGen.Sg" "VVFIN|none" - - size_t numWords; - const StringPiece &annotatedWord = annotatedWordVector.back(); - if (annotatedWord.size() >= 2 - && *annotatedWord.data() == '[' - && annotatedWord.data()[annotatedWord.size() - 1] == ']') { - // hiero/syntax rule - CHECK(lhs); - - numWords = annotatedWordVector.size()-1; - - // lhs - lhs->CreateFromString(direction, factorOrder, annotatedWord.substr(1, annotatedWord.size() - 2), true); - assert(lhs->IsNonTerminal()); - } - else { - CHECK(lhs == NULL); - - numWords = annotatedWordVector.size(); - } - - // parse each word - m_words.reserve(numWords); - - for (size_t phrasePos = 0 ; phrasePos < numWords; phrasePos++) { - StringPiece &annotatedWord = annotatedWordVector[phrasePos]; - bool isNonTerminal; - if (annotatedWord.size() >= 2 && *annotatedWord.data() == '[' && annotatedWord.data()[annotatedWord.size() - 1] == ']') { - // non-term - isNonTerminal = true; - - size_t nextPos = annotatedWord.find('[', 1); - CHECK(nextPos != string::npos); - - if (direction == Input) - annotatedWord = annotatedWord.substr(1, nextPos - 2); - else - annotatedWord = annotatedWord.substr(nextPos + 1, annotatedWord.size() - nextPos - 2); - } else { - isNonTerminal = false; - } - - Word &word = AddWord(); - word.CreateFromString(direction, factorOrder, annotatedWord, isNonTerminal); - - } - - -} - int Phrase::Compare(const Phrase &other) const { #ifdef min |