Fix a grammar error; add more test case.

- Fix a warning, too.
This commit is contained in:
Tetsuo Kiso 2012-04-05 10:10:16 +09:00
parent 8a2495c966
commit 2bfeb39ba6
3 changed files with 7 additions and 2 deletions

View File

@ -68,7 +68,7 @@ inline T Scan(const std::string &input)
/**
* Returns true iff "str" ends with "suffix".
* e.g., Given str = "abc:" and suffix = ":", this functions returns true.
* e.g., Given str = "abc:" and suffix = ":", this function returns true.
*/
inline bool EndsWith(const std::string& str, const char* suffix) {
return str.find_last_of(suffix) == str.size() - 1;

View File

@ -68,4 +68,9 @@ BOOST_AUTO_TEST_CASE(util_ends_with_test) {
BOOST_CHECK(EndsWith("abc:", ":"));
BOOST_CHECK(EndsWith("a b c:", ":"));
BOOST_CHECK(!EndsWith("a", ":"));
BOOST_CHECK(!EndsWith("a:b", ":"));
BOOST_CHECK(EndsWith("ab ", " "));
BOOST_CHECK(!EndsWith("ab", " "));
BOOST_CHECK(!EndsWith("a b", " "));
}

View File

@ -73,7 +73,7 @@ public:
static float sentenceLevelBleuPlusOne(const vector<float>& stats) {
float logbleu = 0.0;
for (unsigned int j=0; j<kBleuNgramOrder; j++) {
for (int j = 0; j < kBleuNgramOrder; j++) {
//cerr << (stats.get(2*j)+1) << "/" << (stats.get(2*j+1)+1) << " ";
logbleu += log(stats[2*j]+1) - log(stats[2*j+1]+1);
}