diff options
author | Hieu Hoang <fishandfrolick@gmail.com> | 2012-06-20 18:01:15 +0400 |
---|---|---|
committer | Hieu Hoang <fishandfrolick@gmail.com> | 2012-06-20 18:01:15 +0400 |
commit | 9a99d31a5c31feab3b82f5f047d4ae98dfa37857 (patch) | |
tree | 4554ea8c231901f58850462f66d043799d55a69d /contrib | |
parent | 112b4c768d8a7ca9a3e718e5c5862a843da2a526 (diff) | |
parent | e5bec4a48b1e520d9f5538a9215737ad1be760df (diff) |
Merge branch 'master' of github.com:moses-smt/mosesdecoder
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/sigtest-filter/filter-pt.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/contrib/sigtest-filter/filter-pt.cpp b/contrib/sigtest-filter/filter-pt.cpp index 5aa7766d0..5ee5ee5b5 100644 --- a/contrib/sigtest-filter/filter-pt.cpp +++ b/contrib/sigtest-filter/filter-pt.cpp @@ -281,7 +281,7 @@ SentIdSet find_occurrences(const std::string& rule, C_SuffixArraySearchApplicati int endPos = 0; vector<std::string> phrases; - while (rule.find("[X][X] ", pos) < rule.size()-10) { + while (rule.find("[X][X] ", pos) < rule.size()) { endPos = rule.find("[X][X] ",pos) - 1; // -1 to cut space before NT if (endPos < pos) { // no space: NT at start of rule (or two consecutive NTs) pos += 7; @@ -291,16 +291,11 @@ SentIdSet find_occurrences(const std::string& rule, C_SuffixArraySearchApplicati pos = endPos + 8; } - // NT at end of rule - if (rule.find(" [X][X] [X]", pos) < rule.size()) { - endPos = rule.size()-11; - } - // rule doesn't end with NT: cut LHS of rule - else { - endPos = rule.size()-4; + // cut LHS of rule + endPos = rule.size()-4; + if (endPos > pos) { + phrases.push_back(rule.substr(pos,endPos-pos)); } - - phrases.push_back(rule.substr(pos,endPos-pos)); sa_set = lookup_multiple_phrases(phrases, my_sa, rule, cache); } else { |