Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTetsuo Kiso <tetsuo-s@is.naist.jp>2012-04-04 17:04:51 +0400
committerTetsuo Kiso <tetsuo-s@is.naist.jp>2012-04-04 17:04:51 +0400
commit27515f5de1fe952489d9cab8d6dee6304dc612ae (patch)
treeb948f6b01c85bfe7f9a6d043fec2b900f9726eba /mert/Data.cpp
parent8782b6df38eceb614f71f24d8ec500f2c4188ea9 (diff)
Add a function to check whether a string ends with a suffix.
- Use the function in Data::InitFeatureMap(). - Add an unit test for InitFeatureMap(). - Move helper functions for Data::loadnbest() to public for unit testing.
Diffstat (limited to 'mert/Data.cpp')
-rw-r--r--mert/Data.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/mert/Data.cpp b/mert/Data.cpp
index b1950ea4e..b0b8f12be 100644
--- a/mert/Data.cpp
+++ b/mert/Data.cpp
@@ -173,14 +173,13 @@ void Data::InitFeatureMap(const string& str) {
string features = "";
string tmp_name = "";
size_t tmp_index = 0;
- string::size_type loc;
char tmp[64]; // for snprintf();
while (!buf.empty()) {
getNextPound(buf, substr);
// string ending with ":" are skipped, because they are the names of the features
- if ((loc = substr.find_last_of(":")) != substr.length()-1) {
+ if (!EndsWith(substr, ":")) {
snprintf(tmp, sizeof(tmp), "%s_%lu ", tmp_name.c_str(), tmp_index);
features.append(tmp);