Commit Graph

310 Commits

Author SHA1 Message Date
Tetsuo Kiso
fe79b96328 Use std::stringstream instead of using snprintf() for Windows.
This commit fixes compilation problems related to
snprintf() for Windows users.

Thanks to Raka Prasetya for reporting the errors.
Thanks also to Kenneth Heafield and Barry Haddow for suggestions.
2012-04-18 23:47:48 +09:00
Tetsuo Kiso
408dd72f9d Pass by reference instead of returning objects.
In the previous implementation, copy-constructor got called, which
was not necessary. This commit prevents it, making code more efficient.
2012-04-12 09:40:52 +09:00
Tetsuo Kiso
0e9b5fd9d0 Add const to return values of overloaded operators.
* This commit prevents developers from doing mistakes like:

  Point p1, p2, p4;
  if (p1 + p2 = p4) { // Bang! We actually wanted to compare
                      // the result of two points: (p1 + p2 == p4).
    // do something.
  }

See, e.g., http://www.gotw.ca/gotw/006.htm for details.

* Add more test cases according to this change.
* Move a helper function to compare floating point numbers
  to Util.h.
2012-04-12 09:16:27 +09:00
Tetsuo Kiso
49a4be2899 Reduce the number of calling the numeric_limits constructor.
- Create a test module for Point.
- Add test cases.
2012-04-12 05:19:11 +09:00
Tetsuo Kiso
65dc5a391f Update mert/TODO 2012-04-08 22:47:20 +09:00
Tetsuo Kiso
4c38bbb434 Add things to TODO. 2012-04-08 22:45:04 +09:00
Tetsuo Kiso
d034eeb703 Add test cases for BLEU and sentence-level BLEU+1.
- Move a definition of sentenceLevelBleuPlusOne() from pro.cpp
  to BleuScorer.cpp.
- Add check for the length of an input vector.
2012-04-07 01:02:32 +09:00
Tetsuo Kiso
bcc1958d94 Fix a warning; remove duplicate function calls. 2012-04-05 12:49:49 +09:00
Tetsuo Kiso
fecee1c4fc Fix a grammar error; add more test case.
- Fix a warning, too.
2012-04-05 10:10:16 +09:00
Tetsuo Kiso
e2a92c0f91 Use EndsWith(). 2012-04-05 00:03:13 +09:00
Tetsuo Kiso
20b99ed9e9 Add a test case for EndsWith(). 2012-04-04 22:43:51 +09:00
Tetsuo Kiso
a6cec240c0 Fix typo. 2012-04-04 22:36:22 +09:00
Tetsuo Kiso
eaa0ab486a Add a test case for BLEU's clipped counts.
- Make BleuScorer::setReferenceFiles() more testable by
  adding OpenReference() and OpenReferenceStream().
2012-04-04 22:33:30 +09:00
Tetsuo Kiso
6c69a97cbb Fix a compilation error. 2012-04-04 22:11:43 +09:00
Tetsuo Kiso
27515f5de1 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.
2012-04-04 22:04:51 +09:00
Tetsuo Kiso
9686e86c70 Fix a warning: comparison between signed and unsigned integers. 2012-03-31 10:47:28 +09:00
Tetsuo Kiso
24b1314d90 Fix indentation. 2012-03-31 10:43:54 +09:00
Tetsuo Kiso
59f755587a Prefix a private member of Optimizer with "m_". 2012-03-31 10:39:59 +09:00
Hieu Hoang
fba75a885e typedef error on mac 2012-03-30 18:33:50 +07:00
tosch
fab03f5a6e added an (optional) positivity constraint to MERT 2012-03-30 11:50:23 +02:00
Matous Machacek
9e5e502687 Merge branch 'master' of github.com:moses-smt/mosesdecoder 2012-03-25 15:51:22 +02:00
Tetsuo Kiso
377d971c5d Use assertions in the test case. 2012-03-25 21:31:44 +09:00
Matous Machacek
1665a23fe1 Added posibility to weight words in sempos 2012-03-24 16:07:47 +01:00
Matous Machacek
ac5ba83ec8 Changed maximum scores constant to be able to experiment with more sempos classes 2012-03-23 23:42:00 +01:00
Tetsuo Kiso
184b24b456 Remove unecessary headers; fix indentation. 2012-03-24 04:12:33 +09:00
Matous Machacek
fbc726dd49 Fixed compilation error 2012-03-23 19:09:04 +01:00
Tetsuo Kiso
5e5f500254 Remove unnecessary headers; prefix private members with "m_".
- Add const.
- Add a virtual destructor to abstract class.
- Add some TODOs to some constant values.

Create files for "overlapping" classes.
2012-03-24 02:39:04 +09:00
Matous Machacek
3319805102 Added SemposScorer to mert and evaluator 2012-03-23 14:39:24 +01:00
Tetsuo Kiso
2f899c9adb Fix a compile error I missed when developing on OS X. 2012-03-21 00:18:44 +09:00
Tetsuo Kiso
0a852b60d1 Move the GzFileBuf implementation into .cpp file.
Add error check when gzopen() fails.
2012-03-21 00:11:54 +09:00
Tetsuo Kiso
91df03e2ed Rename gzfilebuf.h; apply coding style. 2012-03-20 23:48:52 +09:00
Tetsuo Kiso
8e79cd5692 Use assertions in the test case.
It gets easier to detect the point of failure in the test.
2012-03-20 16:57:57 +09:00
Tetsuo Kiso
2fdb47fe67 Add an unit test for BleuScorer.
The test contains only ngram counting. More tests for calculating
BLEU score are reuiqred.
2012-03-20 05:52:35 +09:00
Tetsuo Kiso
8987fed667 Add thread unsafe Singleton class.
- Add Vocabulary factory and the unit test.
- Remove Scorer::ClearVocabulary().
2012-03-20 05:49:10 +09:00
Tetsuo Kiso
1678ee3769 Merge branch 'master' of github.com:moses-smt/mosesdecoder into cleanup-mert 2012-03-20 03:46:17 +09:00
Tetsuo Kiso
525f06452c Change the Encoder class to Vocabulary.
- Introduce the namespace to avoid naming collisions. The class name
  is used in KenLM.
- Add the unit test.
2012-03-20 03:43:04 +09:00
Christian Buck
20f2e703bf changed size_t to std::size_t for gcc4.6 2012-03-19 17:32:55 +00:00
Tetsuo Kiso
2b28072f7a Move Encoder class from Scorer.h to Ngram.h.
To add unit tests.
2012-03-19 23:21:02 +09:00
Tetsuo Kiso
f686e8771a Add some functions to BleuScorer for unit testing.
This commit also includes
- Fix typo.
- Fix indentations.
- Add 'const' to Scorer::applyFactors().
2012-03-19 22:45:15 +09:00
Tetsuo Kiso
54233d3270 Create files for OptimizerFactory class; add the unit test. 2012-03-18 13:08:38 +09:00
Tetsuo Kiso
38c662d4e0 Pass parameters by const reference. 2012-03-18 12:32:11 +09:00
Tetsuo Kiso
0e8184c1c1 Fix a file permission. 2012-03-18 10:52:40 +09:00
Matous Machacek
73d5c9ea4e Fixed bug in CderScorer.cpp 2012-03-17 23:35:56 +01:00
Tetsuo Kiso
6b95a19eda Create Reference class to clean up BleuScorer.
- Add an unit test for Reference.
- Move functions to calculate the reference length from
  BleuScorer to Reference.
2012-03-18 05:58:40 +09:00
Tetsuo Kiso
c6536a134b Clean up BleuScorer. 2012-03-14 22:44:51 +09:00
Tetsuo Kiso
5007f129d8 Clean up BleuScorer with lookup(). 2012-03-14 22:41:29 +09:00
Tetsuo Kiso
fba01c7cdf Create a header file for NgramCounts class.
The reason is that we want to add the unit test.
2012-03-14 22:14:11 +09:00
Tetsuo Kiso
b354da4c65 Clean up accessors and mutators. 2012-03-10 19:27:52 +09:00
Tetsuo Kiso
5d600f2b50 Remove hard-coded "/dev/stdout".
This will improve the portability.
We also change the interface of I/O functions for ease of the
development unit tests.
2012-03-10 19:04:43 +09:00
Tetsuo Kiso
3ce46da4cd Clean up Data; add TODOs. 2012-03-10 17:47:01 +09:00