/disk4/html/www/moses/doxygen/mosesdecoder/lm/model_test.cc File Reference

#include "lm/model.hh"
#include <cstdlib>
#include <cstring>
#include <boost/test/unit_test.hpp>
#include <boost/test/floating_point_comparison.hpp>

Go to the source code of this file.

Namespaces

namespace  lm
namespace  lm::ngram

Defines

#define BOOST_TEST_MODULE   ModelTest
#define SLOPPY_CHECK_CLOSE(ref, value, tol)   BOOST_CHECK_CLOSE(static_cast<double>(ref), static_cast<double>(value), static_cast<double>(tol));
#define StartTest(word, ngram, score, indep_left)
#define AppendTest(word, ngram, score, indep_left)
#define StatelessTest(word, provide, ngram, score)

Functions

std::ostream & lm::ngram::operator<< (std::ostream &o, const State &state)


Define Documentation

#define AppendTest ( word,
ngram,
score,
indep_left   ) 

Value:

StartTest(word, ngram, score, indep_left) \
  state = out;

Definition at line 62 of file model_test.cc.

#define BOOST_TEST_MODULE   ModelTest

Definition at line 6 of file model_test.cc.

#define SLOPPY_CHECK_CLOSE ( ref,
value,
tol   )     BOOST_CHECK_CLOSE(static_cast<double>(ref), static_cast<double>(value), static_cast<double>(tol));

Definition at line 11 of file model_test.cc.

#define StartTest ( word,
ngram,
score,
indep_left   ) 

Value:

ret = model.FullScore( \
      state, \
      model.GetVocabulary().Index(word), \
      out);\
  SLOPPY_CHECK_CLOSE(score, ret.prob, 0.001); \
  BOOST_CHECK_EQUAL(static_cast<unsigned int>(ngram), ret.ngram_length); \
  BOOST_CHECK_GE(std::min<unsigned char>(ngram, 5 - 1), out.length); \
  BOOST_CHECK_EQUAL(indep_left, ret.independent_left); \
  BOOST_CHECK_EQUAL(out, GetState(model, word, state));

Definition at line 51 of file model_test.cc.

#define StatelessTest ( word,
provide,
ngram,
score   ) 

Value:

ret = model.FullScoreForgotState(indices + num_words - word, indices + num_words - word + provide, indices[num_words - word - 1], state); \
  SLOPPY_CHECK_CLOSE(score, ret.prob, 0.001); \
  BOOST_CHECK_EQUAL(static_cast<unsigned int>(ngram), ret.ngram_length); \
  model.GetState(indices + num_words - word, indices + num_words - word + provide, before); \
  ret = model.FullScore(before, indices[num_words - word - 1], out); \
  BOOST_CHECK(state == out); \
  SLOPPY_CHECK_CLOSE(score, ret.prob, 0.001); \
  BOOST_CHECK_EQUAL(static_cast<unsigned int>(ngram), ret.ngram_length);

Definition at line 226 of file model_test.cc.


Variable Documentation

std::vector<std::string> seen

Definition at line 321 of file model_test.cc.

Referenced by main().


Generated on Thu Jul 6 00:31:25 2017 for Moses by  doxygen 1.5.9