38 #include "../proto/data.pb.h"
39 #include "../proto/dataio.h"
45 using namespace reranker;
48 int main(
int argc,
char **argv) {
50 bool is_compressed =
true;
51 bool use_base64 =
true;
52 ConfusionProtoIO* reader = NULL;
54 reader =
new ConfusionProtoIO(argv[1], ConfusionProtoIO::READ,
55 is_compressed, use_base64);
57 reader =
new ConfusionProtoIO(
"", ConfusionProtoIO::READSTD,
58 is_compressed, use_base64);
60 bool reader_valid =
true;
62 while (reader_valid) {
63 confusion_learning::CandidateSetMessage tmp_msg;
64 reader_valid = reader->Read(&tmp_msg);
65 cspr.
Read(tmp_msg, 1, candidate_set);
67 cout <<
"Here's the one candidate set:" << endl;
68 cout << candidate_set;
75 confusion_learning::CandidateSetMessage cs_msg;
76 cspw.
Write(candidate_set, &cs_msg);
79 cspr.
Read(cs_msg, re_read_candidate_set);
80 cout <<
"Successfully wrote out and then re-read candidate set. Here it is:"
82 << re_read_candidate_set
84 <<
"Have a nice day!" << endl;
void Read(const CandidateSetMessage &m, CandidateSet &set)
Fills in the specified CandidateSet based on the specified CandidateSetMessage, crucially constructin...
Provides the reranker::Candidate class for representing a candidate hypothesis from an initial model...
int main(int argc, char **argv)
void Write(const CandidateSet &set, CandidateSetMessage *candidate_set_message) const
Serializes a CandidateSet instance to a CandidateSetMessage.
A class to construct a CandidateSetMessage from a CandidateSet instance.
Serializer for reranker::CandidateSet instances to CandidateSetMessage instances. ...
A class to hold a set of candidates, either for training or test.
Reads CandidateSetMessage instances and converts them to reranker::CandidateSet instances.
A class to fill in a CandidateSet based on a CandidateSetMessage, crucially constructing new Candidat...
Class to hold a single training instance for a reranker, which is a set of examples, typically the n-best output of some input process, posibly including a gold-standard feature vector.