Skip to content

Commit ff82050

Browse files
committed
better names in lm_types.hpp
1 parent 18fc8ca commit ff82050

7 files changed

+64
-60
lines changed

include/lm_types.hpp

+56-52
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,13 @@
55
#include <boost/preprocessor/cat.hpp>
66

77
#include "../external/emphf/base_hash.hpp"
8-
98
#include "utils/mph_tables.hpp"
10-
119
#include "mph_count_lm.hpp"
1210
#include "mph_prob_lm.hpp"
1311
#include "trie_count_lm.hpp"
1412
#include "trie_prob_lm.hpp"
1513
#include "mappers.hpp"
16-
1714
#include "vectors/hash_compact_vector.hpp"
18-
1915
#include "sequences/ef_sequence.hpp"
2016
#include "sequences/sequence_collections.hpp"
2117
#include "sequences/indexed_codewords_sequence.hpp"
@@ -26,71 +22,77 @@
2622

2723
namespace tongrams {
2824

29-
#define MPH_COUNT_TYPE(HASH_KEY_BITS) \
25+
#define TONGRAMS_MPH_COUNT_TYPE(HASH_KEY_BITS) \
3026
mph_count_lm<sequence_collection, \
3127
hash_compact_vector<uint##HASH_KEY_BITS##_t>, \
3228
emphf::jenkins##HASH_KEY_BITS##_hasher>
3329

34-
#define MPH_PROB_TYPE(HASH_KEY_BITS) \
30+
#define TONGRAMS_MPH_PROB_TYPE(HASH_KEY_BITS) \
3531
mph_prob_lm<quantized_sequence_collection, \
3632
hash_compact_vector<uint##HASH_KEY_BITS##_t>, \
3733
emphf::jenkins##HASH_KEY_BITS##_hasher>
3834

39-
typedef MPH_COUNT_TYPE(32) mph32_count_lm;
40-
typedef MPH_COUNT_TYPE(64) mph64_count_lm;
41-
typedef MPH_PROB_TYPE(32) mph32_prob_lm;
42-
typedef MPH_PROB_TYPE(64) mph64_prob_lm;
35+
typedef TONGRAMS_MPH_COUNT_TYPE(32) mph32_count_lm;
36+
typedef TONGRAMS_MPH_COUNT_TYPE(64) mph64_count_lm;
37+
typedef TONGRAMS_MPH_PROB_TYPE(32) mph32_prob_lm;
38+
typedef TONGRAMS_MPH_PROB_TYPE(64) mph64_prob_lm;
4339

44-
#define TRIE_COUNT_TYPE(MAPPER, COUNT_RANKS, GRAM_SEQUENCE_TYPE) \
45-
trie_count_lm<single_valued_mpht64, MAPPER, sequence_collection, \
40+
#define TONGRAMS_TRIE_COUNT_TYPE(MAPPER, COUNT_RANKS, GRAM_SEQUENCE_TYPE) \
41+
trie_count_lm<single_valued_mpht64, MAPPER, sequence_collection, \
4642
COUNT_RANKS, GRAM_SEQUENCE_TYPE, ef_sequence>
4743

48-
typedef TRIE_COUNT_TYPE(identity_mapper, indexed_codewords_sequence,
49-
fast_ef_sequence) ef_trie_IC_ranks_count_lm;
50-
typedef TRIE_COUNT_TYPE(identity_mapper, prefix_summed_sequence<ef_sequence>,
51-
fast_ef_sequence) ef_trie_PSEF_ranks_count_lm;
52-
typedef TRIE_COUNT_TYPE(identity_mapper,
53-
prefix_summed_sequence<pef::uniform_pef_sequence>,
54-
fast_ef_sequence) ef_trie_PSPEF_ranks_count_lm;
55-
typedef TRIE_COUNT_TYPE(sorted_array_mapper, indexed_codewords_sequence,
56-
fast_ef_sequence) ef_rtrie_IC_ranks_count_lm;
57-
typedef TRIE_COUNT_TYPE(sorted_array_mapper,
58-
prefix_summed_sequence<ef_sequence>,
59-
fast_ef_sequence) ef_rtrie_PSEF_ranks_count_lm;
60-
typedef TRIE_COUNT_TYPE(sorted_array_mapper,
61-
prefix_summed_sequence<pef::uniform_pef_sequence>,
62-
fast_ef_sequence) ef_rtrie_PSPEF_ranks_count_lm;
63-
64-
typedef TRIE_COUNT_TYPE(identity_mapper, indexed_codewords_sequence,
65-
pef::uniform_pef_sequence) pef_trie_IC_ranks_count_lm;
66-
typedef TRIE_COUNT_TYPE(identity_mapper, prefix_summed_sequence<ef_sequence>,
67-
pef::uniform_pef_sequence) pef_trie_PSEF_ranks_count_lm;
68-
typedef TRIE_COUNT_TYPE(
44+
typedef TONGRAMS_TRIE_COUNT_TYPE(identity_mapper, indexed_codewords_sequence,
45+
fast_ef_sequence) ef_trie_IC_ranks_count_lm;
46+
typedef TONGRAMS_TRIE_COUNT_TYPE(identity_mapper,
47+
prefix_summed_sequence<ef_sequence>,
48+
fast_ef_sequence) ef_trie_PSEF_ranks_count_lm;
49+
typedef TONGRAMS_TRIE_COUNT_TYPE(
50+
identity_mapper, prefix_summed_sequence<pef::uniform_pef_sequence>,
51+
fast_ef_sequence) ef_trie_PSPEF_ranks_count_lm;
52+
typedef TONGRAMS_TRIE_COUNT_TYPE(sorted_array_mapper,
53+
indexed_codewords_sequence,
54+
fast_ef_sequence) ef_rtrie_IC_ranks_count_lm;
55+
typedef TONGRAMS_TRIE_COUNT_TYPE(sorted_array_mapper,
56+
prefix_summed_sequence<ef_sequence>,
57+
fast_ef_sequence) ef_rtrie_PSEF_ranks_count_lm;
58+
typedef TONGRAMS_TRIE_COUNT_TYPE(
59+
sorted_array_mapper, prefix_summed_sequence<pef::uniform_pef_sequence>,
60+
fast_ef_sequence) ef_rtrie_PSPEF_ranks_count_lm;
61+
62+
typedef TONGRAMS_TRIE_COUNT_TYPE(identity_mapper, indexed_codewords_sequence,
63+
pef::uniform_pef_sequence)
64+
pef_trie_IC_ranks_count_lm;
65+
typedef TONGRAMS_TRIE_COUNT_TYPE(
66+
identity_mapper, prefix_summed_sequence<ef_sequence>,
67+
pef::uniform_pef_sequence) pef_trie_PSEF_ranks_count_lm;
68+
typedef TONGRAMS_TRIE_COUNT_TYPE(
6969
identity_mapper, prefix_summed_sequence<pef::uniform_pef_sequence>,
7070
pef::uniform_pef_sequence) pef_trie_PSPEF_ranks_count_lm;
71-
typedef TRIE_COUNT_TYPE(sorted_array_mapper, indexed_codewords_sequence,
72-
pef::uniform_pef_sequence) pef_rtrie_IC_ranks_count_lm;
73-
typedef TRIE_COUNT_TYPE(
71+
typedef TONGRAMS_TRIE_COUNT_TYPE(
72+
sorted_array_mapper, indexed_codewords_sequence,
73+
pef::uniform_pef_sequence) pef_rtrie_IC_ranks_count_lm;
74+
typedef TONGRAMS_TRIE_COUNT_TYPE(
7475
sorted_array_mapper, prefix_summed_sequence<ef_sequence>,
7576
pef::uniform_pef_sequence) pef_rtrie_PSEF_ranks_count_lm;
76-
typedef TRIE_COUNT_TYPE(
77+
typedef TONGRAMS_TRIE_COUNT_TYPE(
7778
sorted_array_mapper, prefix_summed_sequence<pef::uniform_pef_sequence>,
7879
pef::uniform_pef_sequence) pef_rtrie_PSPEF_ranks_count_lm;
7980

80-
#define TRIE_PROB_TYPE(MAPPER, GRAM_SEQUENCE_TYPE) \
81+
#define TONGRAMS_TRIE_PROB_TYPE(MAPPER, GRAM_SEQUENCE_TYPE) \
8182
trie_prob_lm<double_valued_mpht64, MAPPER, quantized_sequence_collection, \
8283
compact_vector, GRAM_SEQUENCE_TYPE, ef_sequence>
8384

84-
typedef TRIE_PROB_TYPE(identity_mapper, fast_ef_sequence) ef_trie_prob_lm;
85-
typedef TRIE_PROB_TYPE(identity_mapper,
86-
pef::uniform_pef_sequence) pef_trie_prob_lm;
87-
typedef TRIE_PROB_TYPE(sorted_array_mapper, fast_ef_sequence) ef_rtrie_prob_lm;
88-
typedef TRIE_PROB_TYPE(sorted_array_mapper,
89-
pef::uniform_pef_sequence) pef_rtrie_prob_lm;
90-
} // namespace tongrams
85+
typedef TONGRAMS_TRIE_PROB_TYPE(identity_mapper,
86+
fast_ef_sequence) ef_trie_prob_lm;
87+
typedef TONGRAMS_TRIE_PROB_TYPE(identity_mapper,
88+
pef::uniform_pef_sequence) pef_trie_prob_lm;
89+
typedef TONGRAMS_TRIE_PROB_TYPE(sorted_array_mapper,
90+
fast_ef_sequence) ef_rtrie_prob_lm;
91+
typedef TONGRAMS_TRIE_PROB_TYPE(sorted_array_mapper,
92+
pef::uniform_pef_sequence) pef_rtrie_prob_lm;
9193

9294
// for print_stats.cpp
93-
#define SXLM_TYPES \
95+
#define TONGRAMS_TYPES \
9496
(mph32_count_lm)(mph64_count_lm)(ef_trie_IC_ranks_count_lm)( \
9597
ef_trie_PSEF_ranks_count_lm)(ef_trie_PSPEF_ranks_count_lm)( \
9698
ef_rtrie_IC_ranks_count_lm)(ef_rtrie_PSEF_ranks_count_lm)( \
@@ -102,7 +104,7 @@ typedef TRIE_PROB_TYPE(sorted_array_mapper,
102104

103105
// for check_count_model.cpp
104106
// lookup_perf_test.cpp
105-
#define SXLM_COUNT_TYPES \
107+
#define TONGRAMS_COUNT_TYPES \
106108
(mph32_count_lm)(mph64_count_lm)(ef_trie_IC_ranks_count_lm)( \
107109
ef_trie_PSEF_ranks_count_lm)(ef_trie_PSPEF_ranks_count_lm)( \
108110
ef_rtrie_IC_ranks_count_lm)(ef_rtrie_PSEF_ranks_count_lm)( \
@@ -112,13 +114,13 @@ typedef TRIE_PROB_TYPE(sorted_array_mapper,
112114
pef_rtrie_PSPEF_ranks_count_lm)
113115

114116
// for build_mph_lm.cpp
115-
#define SXLM_HASH_COUNT_TYPES (mph32_count_lm)(mph64_count_lm)
117+
#define TONGRAMS_HASH_COUNT_TYPES (mph32_count_lm)(mph64_count_lm)
116118

117119
// for build_mph_lm.cpp
118-
#define SXLM_HASH_PROB_TYPES (mph32_prob_lm)(mph64_prob_lm)
120+
#define TONGRAMS_HASH_PROB_TYPES (mph32_prob_lm)(mph64_prob_lm)
119121

120122
// for build_trie_lm.cpp
121-
#define SXLM_TRIE_COUNT_TYPES \
123+
#define TONGRAMS_TRIE_COUNT_TYPES \
122124
(ef_trie_IC_ranks_count_lm)(ef_trie_PSEF_ranks_count_lm)( \
123125
ef_trie_PSPEF_ranks_count_lm)(ef_rtrie_IC_ranks_count_lm)( \
124126
ef_rtrie_PSEF_ranks_count_lm)(ef_rtrie_PSPEF_ranks_count_lm)( \
@@ -127,10 +129,12 @@ typedef TRIE_PROB_TYPE(sorted_array_mapper,
127129
pef_rtrie_PSEF_ranks_count_lm)(pef_rtrie_PSPEF_ranks_count_lm)
128130

129131
// for build_trie_lm.cpp
130-
#define SXLM_TRIE_PROB_TYPES \
132+
#define TONGRAMS_TRIE_PROB_TYPES \
131133
(ef_trie_prob_lm)(pef_trie_prob_lm)(ef_rtrie_prob_lm)(pef_rtrie_prob_lm)
132134

133135
// for score.cpp
134-
#define SXLM_SCORE_TYPES \
136+
#define TONGRAMS_SCORE_TYPES \
135137
(ef_trie_prob_lm)(pef_trie_prob_lm)(ef_rtrie_prob_lm)(pef_rtrie_prob_lm)( \
136138
mph32_prob_lm)(mph64_prob_lm)
139+
140+
} // namespace tongrams

src/build_hash.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ int main(int argc, char** argv) {
121121
T model(input_dir, order); \
122122
util::save(header, model, output_filename);
123123

124-
BOOST_PP_SEQ_FOR_EACH(LOOP_BODY, _, SXLM_HASH_COUNT_TYPES);
124+
BOOST_PP_SEQ_FOR_EACH(LOOP_BODY, _, TONGRAMS_HASH_COUNT_TYPES);
125125
#undef LOOP_BODY
126126
} else {
127127
building_util::unknown_type(model_string_type);
@@ -138,7 +138,7 @@ int main(int argc, char** argv) {
138138
builder.build(model); \
139139
util::save(header, model, output_filename);
140140

141-
BOOST_PP_SEQ_FOR_EACH(LOOP_BODY, _, SXLM_HASH_PROB_TYPES);
141+
BOOST_PP_SEQ_FOR_EACH(LOOP_BODY, _, TONGRAMS_HASH_PROB_TYPES);
142142
#undef LOOP_BODY
143143
} else {
144144
building_util::unknown_type(model_string_type);

src/build_trie.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ int main(int argc, char** argv) {
156156
builder.build(model); \
157157
util::save(header, model, output_filename);
158158

159-
BOOST_PP_SEQ_FOR_EACH(LOOP_BODY, _, SXLM_TRIE_COUNT_TYPES);
159+
BOOST_PP_SEQ_FOR_EACH(LOOP_BODY, _, TONGRAMS_TRIE_COUNT_TYPES);
160160
#undef LOOP_BODY
161161
} else {
162162
building_util::unknown_type(model_string_type);
@@ -173,7 +173,7 @@ int main(int argc, char** argv) {
173173
builder.build(model); \
174174
util::save(header, model, output_filename);
175175

176-
BOOST_PP_SEQ_FOR_EACH(LOOP_BODY, _, SXLM_TRIE_PROB_TYPES);
176+
BOOST_PP_SEQ_FOR_EACH(LOOP_BODY, _, TONGRAMS_TRIE_PROB_TYPES);
177177
#undef LOOP_BODY
178178
} else {
179179
building_util::unknown_type(model_string_type);

src/lookup_perf_test.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ int main(int argc, char** argv) {
8585
else if (model_string_type == BOOST_PP_STRINGIZE(T)) { \
8686
perf_test<T>(index_filename, query_filename, runs);
8787

88-
BOOST_PP_SEQ_FOR_EACH(LOOP_BODY, _, SXLM_COUNT_TYPES);
88+
BOOST_PP_SEQ_FOR_EACH(LOOP_BODY, _, TONGRAMS_COUNT_TYPES);
8989
#undef LOOP_BODY
9090
} else {
9191
std::cerr << "Error: lookup() not supported with type "

src/print_stats.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ int main(int argc, char** argv) {
3030
else if (model_string_type == BOOST_PP_STRINGIZE(T)) { \
3131
print_stats<T>(index_filename);
3232

33-
BOOST_PP_SEQ_FOR_EACH(LOOP_BODY, _, SXLM_TYPES);
33+
BOOST_PP_SEQ_FOR_EACH(LOOP_BODY, _, TONGRAMS_TYPES);
3434
#undef LOOP_BODY
3535
} else {
3636
building_util::unknown_type(model_string_type);

src/score.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ int main(int argc, char** argv) {
9999
else if (model_string_type == BOOST_PP_STRINGIZE(T)) { \
100100
score_corpus<T>(index_filename, corpus_filename);
101101

102-
BOOST_PP_SEQ_FOR_EACH(LOOP_BODY, _, SXLM_SCORE_TYPES);
102+
BOOST_PP_SEQ_FOR_EACH(LOOP_BODY, _, TONGRAMS_SCORE_TYPES);
103103
#undef LOOP_BODY
104104
} else {
105105
std::cerr << "Error: score() not supported with type "

test/test_count_model.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ int main(int argc, char** argv) {
5454
<< std::endl; \
5555
check_model<T>(model, input_folder);
5656

57-
BOOST_PP_SEQ_FOR_EACH(LOOP_BODY, _, SXLM_COUNT_TYPES);
57+
BOOST_PP_SEQ_FOR_EACH(LOOP_BODY, _, TONGRAMS_COUNT_TYPES);
5858
#undef LOOP_BODY
5959
} else {
6060
std::cerr << "Error: check not supported with type "

0 commit comments

Comments
 (0)