diff options
author | Hieu Hoang <hieu@hoang.co.uk> | 2013-05-22 17:16:44 +0400 |
---|---|---|
committer | Hieu Hoang <hieu@hoang.co.uk> | 2013-05-22 17:16:44 +0400 |
commit | b1edb968a3b5d6aa4b2694503ddd95a2d09b41b3 (patch) | |
tree | 75fb0e4f379a8dc504de7452117ce6b1e39926ee /moses/Phrase.cpp | |
parent | bce3b361700a5d7b0fbdeba466d9b372cd0fa3e0 (diff) |
Make Phrase::CreateFromString() more efficient
Diffstat (limited to 'moses/Phrase.cpp')
-rw-r--r-- | moses/Phrase.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/moses/Phrase.cpp b/moses/Phrase.cpp index 175801d75..7888c1629 100644 --- a/moses/Phrase.cpp +++ b/moses/Phrase.cpp @@ -180,14 +180,17 @@ void Phrase::CreateFromString(FactorDirection direction numWords = annotatedWordVector.size()-1; // lhs - CHECK(lhs); + assert(lhs); + (*lhs) = new Word(true); (*lhs)->CreateFromString(direction, factorOrder, annotatedWord.substr(1, annotatedWord.size() - 2), true); assert((*lhs)->IsNonTerminal()); } else { - //CHECK(lhs == NULL); - numWords = annotatedWordVector.size(); + //CHECK(lhs == NULL); + if (lhs) { + (*lhs) = NULL; + } } // parse each word |