From 5f680cc45266112c0a6f51f8d9eeb99732a6e2d7 Mon Sep 17 00:00:00 2001 From: Chris Dyer Date: Thu, 14 Mar 2013 23:38:41 -0400 Subject: source path features --- decoder/ff_source_path.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 decoder/ff_source_path.h (limited to 'decoder/ff_source_path.h') diff --git a/decoder/ff_source_path.h b/decoder/ff_source_path.h new file mode 100644 index 00000000..03126412 --- /dev/null +++ b/decoder/ff_source_path.h @@ -0,0 +1,26 @@ +#ifndef _FF_SOURCE_PATH_H_ +#define _FF_SOURCE_PATH_H_ + +#include +#include +#include "ff.h" + +class SourcePathFeatures : public FeatureFunction { + public: + SourcePathFeatures(const std::string& param); + protected: + virtual void TraversalFeaturesImpl(const SentenceMetadata& smeta, + const HG::Edge& edge, + const std::vector& ant_contexts, + SparseVector* features, + SparseVector* estimated_features, + void* context) const; + + private: + void FireBigramFeature(WordID prev, WordID cur, SparseVector* features) const; + void FireUnigramFeature(WordID cur, SparseVector* features) const; + mutable std::map > bigram_fids; + mutable std::map unigram_fids; +}; + +#endif -- cgit v1.2.3