ZGen  0.2.0
a linearization system for natural language.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
learner.h
Go to the documentation of this file.
1 #ifndef __ZGEN_SHIFTREDUCE_LEARNER_H__
2 #define __ZGEN_SHIFTREDUCE_LEARNER_H__
3 
4 #include "shiftreduce/option.h"
8 
9 namespace ZGen {
10 namespace ShiftReduce {
11 
12 class Learner {
13 public:
14  Learner(const option_t& opts,
15  Model* model,
16  const DecodeContext* ctx);
17 
23  void set_timestamp(int timestamp);
24 
33  void learn(const StateItem* last_state_of_predict_chain,
34  const StateItem* last_state_of_correct_chain);
35 
42  void finish_learning(int now);
43 private:
44  const option_t& opts;
45  int timestamp;
46  Model* model;
47  const DecodeContext* ctx;
48  const StateItem* predict_state_chain[kMaxSteps];
49  const StateItem* correct_state_chain[kMaxSteps];
50 };
51 
52 } // end for namespace ShiftReduce
53 } // end for namespace ZGen
54 
55 #endif // end for __ZGEN_SHIFTREDUCE_LEARNER_H__
Definition: state.h:15
Definition: option.h:10
Definition: model.h:12
Definition: learner.h:12
void finish_learning(int now)
Used to maintain the memory cache used by the decoder.
Definition: decode_context.h:9
void learn(const StateItem *last_state_of_predict_chain, const StateItem *last_state_of_correct_chain)
Definition: learner.cc:22
Learner(const option_t &opts, Model *model, const DecodeContext *ctx)
Definition: learner.cc:7
void set_timestamp(int timestamp)
Definition: learner.cc:17
const int kMaxSteps
Definition: settings.h:10