44 #include "../utils/kdebug.h"
53 int main(
int argc,
char* argv[]) {
55 bool uniform_mix =
false;
56 int mix_denominator = 1.0;
57 bool reduce_symbols =
false;
60 while ((option_char = getopt(argc, argv,
"ud:S")) != EOF) {
61 switch (option_char) {
63 reduce_symbols =
true;
68 mix_denominator = atoi(optarg);
71 cerr <<
"usage: " << argv[0] <<
"[-K] [-u] [-d denom]" << endl;
72 cerr <<
"-u - mix the features uniformly (overrides -d)" << endl;
73 cerr <<
"-d - normalize mixture with this value" << endl;
74 cerr <<
"-S - Run this in symbol reducer mode (unique)" << endl;
91 getline(cin, input_data);
92 if (input_data.empty()) {
96 sym_reducer.
Reduce(input_data, empty_string);
98 int delim_pos = input_data.find(
'\t');
99 string feat_id = input_data.substr(0, delim_pos);
100 string value = input_data.substr(delim_pos + 1);
103 if (feat_id.compare(ModelInfoReducer::kModelMessageFeatureName) == 0) {
104 reducer = &model_reducer;
106 reducer = &feat_reducer;
108 reducer->
Reduce(feat_id, value);
111 if (!reduce_symbols) {
112 feat_reducer.
Flush();
113 model_reducer.
Flush();
virtual int Reduce(const string &key, const string &value)
A reducer class which processes FeatureMessage proto buffers.
int main(int argc, char *argv[])
Reducer classes for trainer.
virtual int Reduce(const string &key, const string &value)=0
Abstract base-class for a streaming reducer.
A reducer class which processes SymbolMessage messages and returns a set of unique them into a single...
A reducer class which processes ModelMessage protocol messages and merges them into a single message...