#include "lm/left.hh"
#include "lm/model.hh"
#include "util/tokenize_piece.hh"
#include <vector>
#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 LeftTest |
#define | Term(word) score.Terminal(m.GetVocabulary().Index(word)); |
#define | VCheck(word, value) BOOST_CHECK_EQUAL(m.GetVocabulary().Index(word), value); |
#define | SLOPPY_CHECK_CLOSE(ref, value, tol) BOOST_CHECK_CLOSE(static_cast<double>(ref), static_cast<double>(value), static_cast<double>(tol)); |
#define | TEXT_TEST(str) |
#define | CHECK_SCORE(str, val) |
#define BOOST_TEST_MODULE LeftTest |
Definition at line 8 of file left_test.cc.
#define CHECK_SCORE | ( | str, | |||
val | ) |
Value:
{ \ float got = val; \ std::vector<WordIndex> indices; \ LookupVocab(m, str, indices); \ SLOPPY_CHECK_CLOSE(LeftToRight(m, indices), got, 0.001); \ }
Definition at line 278 of file left_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 20 of file left_test.cc.
#define Term | ( | word | ) | score.Terminal(m.GetVocabulary().Index(word)); |
Definition at line 16 of file left_test.cc.
#define TEXT_TEST | ( | str | ) |
Value:
LookupVocab(m, str, words); \ expect = LeftToRight(m, words, rest); \ SLOPPY_CHECK_CLOSE(expect, RightToLeft(m, words, rest), 0.001); \ SLOPPY_CHECK_CLOSE(expect, TreeMiddle(m, words, rest), 0.001); \
Definition at line 172 of file left_test.cc.
#define VCheck | ( | word, | |||
value | ) | BOOST_CHECK_EQUAL(m.GetVocabulary().Index(word), value); |
Definition at line 17 of file left_test.cc.