diff options
author | Chris Dyer <cdyer@cab.ark.cs.cmu.edu> | 2012-10-11 21:57:18 -0400 |
---|---|---|
committer | Chris Dyer <cdyer@cab.ark.cs.cmu.edu> | 2012-10-11 21:57:18 -0400 |
commit | 64f5a686dbfb128b7dfce1d6d842ba976da8c22f (patch) | |
tree | 6c81fe8b366f3ad84f38e8e075beb965bf04a722 /decoder/ff_external.h | |
parent | 07ea7b64b6f85e5798a8068453ed9fd2b97396db (diff) |
add support for dlopen'd feature functions
Diffstat (limited to 'decoder/ff_external.h')
-rw-r--r-- | decoder/ff_external.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/decoder/ff_external.h b/decoder/ff_external.h new file mode 100644 index 00000000..283e58e8 --- /dev/null +++ b/decoder/ff_external.h @@ -0,0 +1,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 |