summaryrefslogtreecommitdiff
path: root/decoder/ff_context.h
diff options
context:
space:
mode:
authorChris Dyer <cdyer@cs.cmu.edu>2012-06-18 18:34:21 -0400
committerChris Dyer <cdyer@cs.cmu.edu>2012-06-18 18:34:21 -0400
commit953ec50e659084c13433ea311f6a07e7e1b292f8 (patch)
treee04361bc661740a08a8bf045aa8c4e5bcd691d85 /decoder/ff_context.h
parentd9d602cf26e3696a5e575f314547b823254dba32 (diff)
parent681ba488e82b8e2079f2d6c2af63014fa86834ac (diff)
Merge branch 'master' of github.com:redpony/cdec
Diffstat (limited to 'decoder/ff_context.h')
-rw-r--r--decoder/ff_context.h29
1 files changed, 26 insertions, 3 deletions
diff --git a/decoder/ff_context.h b/decoder/ff_context.h
index 0d22b027..89bcb557 100644
--- a/decoder/ff_context.h
+++ b/decoder/ff_context.h
@@ -1,23 +1,46 @@
+
#ifndef _FF_CONTEXT_H_
#define _FF_CONTEXT_H_
#include <vector>
+#include <boost/xpressive/xpressive.hpp>
#include "ff.h"
+using namespace boost::xpressive;
+using namespace std;
+
class RuleContextFeatures : public FeatureFunction {
public:
- RuleContextFeatures(const std::string& param);
+ RuleContextFeatures(const string& param);
protected:
virtual void TraversalFeaturesImpl(const SentenceMetadata& smeta,
const Hypergraph::Edge& edge,
- const std::vector<const void*>& ant_contexts,
+ const vector<const void*>& ant_contexts,
SparseVector<double>* features,
SparseVector<double>* estimated_features,
void* context) const;
virtual void PrepareForInput(const SentenceMetadata& smeta);
+ virtual void ParseArgs(const string& in);
+ virtual string Escape(const string& x) const;
+ virtual void ReplaceMacroWithString(string& feature_instance,
+ bool token_vs_label,
+ int relative_location,
+ const string& actual_token) const;
+ virtual void ReplaceTokenMacroWithString(string& feature_instance,
+ int relative_location,
+ const string& actual_token) const;
+ virtual void ReplaceLabelMacroWithString(string& feature_instance,
+ int relative_location,
+ const string& actual_token) const;
+ virtual void Error(const string&) const;
+
private:
- std::vector<WordID> current_input;
+ vector<int> token_relative_locations, label_relative_locations;
+ string feature_template;
+ vector<WordID> current_input;
WordID kSOS, kEOS;
+ sregex macro_regex;
+
};
#endif