| 36 | // ---------------------------------------------------------------------------------------- |
| 37 | |
| 38 | void test_word_ngrams() |
| 39 | { |
| 40 | const unsigned long num_buckets = 1 << 20; |
| 41 | const std::vector<std::string> tokens = {"a", "b", "a", "b"}; |
| 42 | DLIB_TEST(hash_word_ngrams(tokens, 1, 2, num_buckets) == |
| 43 | expected({"a", "b", "a", "b", "a b", "b a", "a b"}, num_buckets)); |
| 44 | DLIB_TEST(hash_word_ngrams(tokens, 3, 3, num_buckets) == |
| 45 | expected({"a b a", "b a b"}, num_buckets)); |
| 46 | DLIB_TEST(hash_word_ngrams(tokens, 5, 6, num_buckets).empty()); |
| 47 | DLIB_TEST(hash_word_ngrams(std::vector<std::string>(), 1, 2, num_buckets).empty()); |
| 48 | } |
| 49 | |
| 50 | // ---------------------------------------------------------------------------------------- |
| 51 |
no test coverage detected