Reranker Framework (ReFr)
Reranking framework for structure prediction and discriminative language modeling
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
executive-feature-extractor-test.C
Go to the documentation of this file.
1 // Copyright 2012, Google Inc.
2 // All rights reserved.
3 //
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are
6 // met:
7 //
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above
11 // copyright notice, this list of conditions and the following disclaimer
12 // in the documentation and/or other materials provided with the
13 // distribution.
14 // * Neither the name of Google Inc. nor the names of its
15 // contributors may be used to endorse or promote products derived from
16 // this software without specific prior written permission.
17 //
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 // -----------------------------------------------------------------------------
30 //
31 //
35 
36 #include <string>
37 
38 #include "feature-extractor.H"
41 
42 using namespace std;
43 using namespace reranker;
44 
45 int
46 main(int argc, char **argv) {
47  if (argc != 2) {
48  cout << "usage: <feature extractor config filename>" << endl;
49  return -1;
50  }
51  shared_ptr<ExecutiveFeatureExtractor> efe;
52  efe = ExecutiveFeatureExtractor::InitFromSpec(argv[1]);
53 
54  CandidateSet candidate_set("test candidate set");
55  candidate_set.set_reference_string("This is a reference string.");
56  shared_ptr<Candidate> c1(new Candidate(0, 0.1, 0.7, 5,
57  "This is a silly string."));
58  candidate_set.AddCandidate(c1);
59  shared_ptr<Candidate> c2(new Candidate(1, 0.2, 0.8, 5,
60  "This is a sillier string."));
61  candidate_set.AddCandidate(c2);
62 
63  efe->Extract(candidate_set);
64 
65  cout << candidate_set << endl;
66 }
void set_reference_string(const string &reference_string)
Provides the reranker::FeatureExtractor interface.
void AddCandidate(shared_ptr< Candidate > candidate)
Provides the reranker::ExecutiveFeatureExtractor class.
int main(int argc, char **argv)
A class to hold a set of candidates, either for training or test.
Definition: candidate-set.H:62
Provides the reranker::ExampleFeatureExtractor class, which illustrates how to write a reranker::Feat...
A class to represent a candidate in a set of candidates that constitutes a training instance for a re...
Definition: candidate.H:60