blob: ed159853bc3f0338aa411e6788cb2993f9cb3598 (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
 | #ifndef FF_FSA_H
#define FF_FSA_H
#include <stdint.h> //C99
#include <string>
#include "ff.h"
#include "sparse_vector.h"
#include "value_array.h"
#include "tdict.h"
typedef ValueArray<uint8_t> Bytes;
/*
 */
struct FsaFeatureFunction {
  std::string name;
  // state for backoff
  // scan
  // heuristic
  // all strings x of this length must end in the same state
  virtual int MarkovOrder() const {
    return 0;
  }
};
// regular bottom up scorer from Fsa feature
template <class Impl>
struct FeatureFunctionFromFsa : public FeatureFunction {
  Impl& d() { return static_cast<Impl&>(*this); }
  Impl const& d() { return static_cast<Impl const&>(*this); }
  FeatureFunctionFromFsa() {  }
  Init() {
    name=d().name;
    SetStateSize(sizeof(WordID)*2*MarkovOrder
  } // can't do this in constructor because we come before d() in order
  virtual Features Features() const { return d().Features(); }
};
#endif
 |