summaryrefslogtreecommitdiff
path: root/decoder/ff_external.h
blob: 283e58e86b108eec4d5c3a776329f6e87c5d6b76 (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
#ifndef _FFEXTERNAL_H_
#define _FFEXTERNAL_H_

#include "ff.h"

// dynamically loaded feature function
class ExternalFeature : public FeatureFunction {
 public:
  ExternalFeature(const std::string& param);
  ~ExternalFeature();
  virtual void PrepareForInput(const SentenceMetadata& smeta);
  virtual void FinalTraversalFeatures(const void* context,
                                      SparseVector<double>* features) const;
 protected:
  virtual void TraversalFeaturesImpl(const SentenceMetadata& smeta,
                                     const Hypergraph::Edge& edge,
                                     const std::vector<const void*>& ant_contexts,
                                     FeatureVector* features,
                                     FeatureVector* estimated_features,
                                     void* context) const;
 private:
  void* lib_handle;
  FeatureFunction* ff_ext;
};

#endif