diff options
author | Tetsuo Kiso <tetsuo-s@is.naist.jp> | 2012-02-20 03:02:23 +0400 |
---|---|---|
committer | Tetsuo Kiso <tetsuo-s@is.naist.jp> | 2012-02-20 03:02:23 +0400 |
commit | a70925317e24ccd932411e170fd305c8d0080c83 (patch) | |
tree | caa4cc2559630b2e00de987ad55cd82612ef7606 /mert | |
parent | 5d1cfa0ebb164ed8d709c9d6e02f36dfb3134087 (diff) |
Put global variables in mert/util.cpp in anonymous space.
We do not allow clients to access the following variables.
Instead, use the APIs which we provide for that.
Also, remove the unused function, and fix smoke tests.
Diffstat (limited to 'mert')
-rw-r--r-- | mert/Util.cpp | 31 | ||||
-rwxr-xr-x | mert/example/gzipped_test.sh | 6 |
2 files changed, 11 insertions, 26 deletions
diff --git a/mert/Util.cpp b/mert/Util.cpp index 63b10d7be..5142b526a 100644 --- a/mert/Util.cpp +++ b/mert/Util.cpp @@ -11,29 +11,28 @@ using namespace std; -// global variables -Timer g_timer; - -int verbose = 0; - namespace { +Timer g_timer; +int g_verbose = 0; + bool FindDelimiter(const std::string &str, const std::string &delim, size_t *pos) { *pos = str.find(delim); return *pos != std::string::npos ? true : false; } + } // namespace int verboselevel() { - return verbose; + return g_verbose; } int setverboselevel(int v) { - verbose = v; - return verbose; + g_verbose = v; + return g_verbose; } size_t getNextPound(std::string &str, std::string &substr, @@ -73,22 +72,6 @@ void Tokenize(const char *str, const char delim, } } -int swapbytes(char *p, int sz, int n) -{ - char c, *l, *h; - - if((n < 1) || (sz < 2)) return 0; - for (; n--; p += sz) { - for (h = (l = p) + sz; --h > l; l++) { - c = *h; - *h = *l; - *l = c; - } - } - return 0; - -} - void ResetUserTime() { g_timer.start(); diff --git a/mert/example/gzipped_test.sh b/mert/example/gzipped_test.sh index a1bb0bf76..f52613da1 100755 --- a/mert/example/gzipped_test.sh +++ b/mert/example/gzipped_test.sh @@ -16,6 +16,8 @@ $extractor --nbest NBEST.gz --reference REF.0,REF.1,REF.2 \ --ffile FEATSTAT_gz --scfile SCORESTAT_gz \ --sctype BLEU 2> extractor_gz1.log +gzip -d NBEST.gz + $extractor --nbest NBEST --reference REF.0,REF.1,REF.2 \ --prev-ffile FEATSTAT --prev-scfile SCORESTAT \ --ffile FEATSTAT2 --scfile SCORESTAT2 \ @@ -30,10 +32,10 @@ for f in FEATSTAT_gz SCORESTAT_gz; do echo "done." done -$extractor --nbest NBEST.gz --reference REF.0,REF.1,REF.2 \ +$extractor --nbest NBEST --reference REF.0,REF.1,REF.2 \ --prev-ffile FEATSTAT_gz.gz --prev-scfile SCORESTAT_gz.gz \ --ffile FEATSTAT2_gz --scfile SCORESTAT2_gz \ --sctype BLEU 2> extractor_gz3.log -gzip -d NBEST.gz FEATSTAT_gz.gz SCORESTAT_gz.gz +gzip -d FEATSTAT_gz.gz SCORESTAT_gz.gz echo "Done." |