37 #ifndef RERANKER_EXAMPLE_FEATURE_EXTRACTOR_H_
38 #define RERANKER_EXAMPLE_FEATURE_EXTRACTOR_H_
63 cout <<
"ExampleFeatureExtractor: creating instance!" << endl;
69 initializers.
Add(
"arg", &arg_);
70 initializers.
Add(
"strvec", &strvec_);
71 initializers.
Add(
"b", &b_);
84 cout <<
"ExampleFeatureExtractor: set arg to \"" << arg_ <<
"\"" << endl;
85 cout <<
"ExampleFeatureExtractor: set strvec to {";
86 for (vector<string>::const_iterator it = strvec_.begin();
89 cout <<
"\"" << *it <<
"\", ";
92 cout <<
"ExampleFeatureExtractor: set b to " << (b_ ?
"true" :
"false")
95 cout <<
"Environment during construction: " << endl;
125 const string &candidate_sentence = candidate.
raw_data();
126 size_t first_space_idx = candidate_sentence.find_first_of(
" ");
127 const string feature = candidate_sentence.substr(0, first_space_idx);
134 vector<string> strvec_;
const string & raw_data() const
Returns the raw data (typically the sentence) for this candidate.
void Add(const string &name, T *member, bool required=false)
An interface for an environment in which variables of various types are mapped to their values...
A class to represent a candidate in a set of candidates that constitutes a training instance for a re...
V IncrementWeight(const K &uid, V by)
Increments the weight of the specified feature by the specified amount.
virtual void Print(ostream &os) const =0
Prints a human-readable string of all the variables in this environment, their types and...
A container for all the member initializers for a particular Factory-constructible instance...