summaryrefslogtreecommitdiff
path: root/decoder/ff_source_path.h
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2013-03-15 11:39:18 +0100
committerPatrick Simianer <p@simianer.de>2013-03-15 11:39:18 +0100
commit3d8aa307d233f58cfe9ddcc616a8297551a738e3 (patch)
treeb9556fe62c7ac0d7b48d92481acdd06a546b1dc2 /decoder/ff_source_path.h
parentcf67d34738e1487f75739dc1e027b1864a06513b (diff)
parent9f1d72fa4dc231eb8cdb737becfc10452b5daef4 (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'decoder/ff_source_path.h')
-rw-r--r--decoder/ff_source_path.h26
1 files changed, 26 insertions, 0 deletions
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 <vector>
+#include <map>
+#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<const void*>& ant_contexts,
+ SparseVector<double>* features,
+ SparseVector<double>* estimated_features,
+ void* context) const;
+
+ private:
+ void FireBigramFeature(WordID prev, WordID cur, SparseVector<double>* features) const;
+ void FireUnigramFeature(WordID cur, SparseVector<double>* features) const;
+ mutable std::map<WordID, std::map<WordID, int> > bigram_fids;
+ mutable std::map<WordID, int> unigram_fids;
+};
+
+#endif