mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-26 13:23:25 +03:00
Fix a grammar error; add more test case.
- Fix a warning, too.
This commit is contained in:
parent
8a2495c966
commit
2bfeb39ba6
@ -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;
|
||||
|
@ -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", " "));
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user