ZGen  0.2.0
a linearization system for natural language.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
model.h
Go to the documentation of this file.
1 #ifndef __ZGEN_BESTFRIST_MODEL_H__
2 #define __ZGEN_BESTFRIST_MODEL_H__
3 
4 #include "settings.h"
7 
8 namespace ZGen {
9 
10 namespace BestFirst {
11 
12 class Model {
13 public:
14  Model();
15 
22  floatval_t score(const Span& span, bool avg) const;
23 
30  floatval_t score(const ScoreContext& ctx, bool avg) const;
31 
39  void update(const Span& span, int timestamp, floatval_t scale);
40 
48  void update(const ScoreContext& ctx, int timestamp, floatval_t scale);
49 
50  void flush(int timestamp);
51 
59  bool load(std::istream& is);
60 
68  bool save(std::ostream& os);
69 private:
70  std::vector< ScoreMap<UnigramScore> > uscore_repo;
71  std::vector< ScoreMap<BigramScore> > bscore_repo;
72  std::vector< ScoreMap<TrigramScore> > tscore_repo;
73 };
74 
75 } // end for namespace Bestfirst
76 } // end for namespace ZGen
77 
78 
79 #endif // end for __ZGEN_BESTFRIST_MODEL_H__
bool save(std::ostream &os)
Definition: model.cc:150
Model()
Definition: model.cc:73
void flush(int timestamp)
Definition: model.cc:135
double floatval_t
Definition: settings.h:24
bool load(std::istream &is)
Definition: model.cc:168
void update(const Span &span, int timestamp, floatval_t scale)
Definition: model.cc:114
Definition: model.h:12
Definition: score_context.h:13
Definition: span.h:13
floatval_t score(const Span &span, bool avg) const
Definition: model.cc:90