From 1f2cd493ce212feab41f74e180063c1987511d00 Mon Sep 17 00:00:00 2001 From: redpony Date: Tue, 5 Oct 2010 17:33:45 +0000 Subject: add PrepareForInput to ff interface, make sgml markup available to feature functions git-svn-id: https://ws10smt.googlecode.com/svn/trunk@669 ec762483-ff6d-05da-a07a-a48fb63a330f --- decoder/ff.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'decoder/ff.h') diff --git a/decoder/ff.h b/decoder/ff.h index 904b9eb8..e470f9a9 100644 --- a/decoder/ff.h +++ b/decoder/ff.h @@ -52,6 +52,10 @@ public: // stateless feature that doesn't depend on source span: override and return true. then your feature can be precomputed over rules. virtual bool rule_feature() const { return false; } + // called once, per input, before any feature calls to TraversalFeatures, etc. + // used to initialize sentence-specific data structures + virtual void PrepareForInput(const SentenceMetadata& smeta); + //OVERRIDE THIS: virtual Features features() const { return single_feature(FD::Convert(name_)); } // returns the number of bytes of context that this feature function will @@ -274,6 +278,10 @@ class ModelSet { Hypergraph::Edge* edge, SentenceMetadata const& smeta) const; + // this is called once before any feature functions apply to a hypergraph + // it can be used to initialize sentence-specific data structures + void PrepareForInput(const SentenceMetadata& smeta); + bool empty() const { return models_.empty(); } bool stateless() const { return !state_size_; } -- cgit v1.2.3