From 1fc4b6a45c18b52ab2c27eb9a825ad14f31d803b Mon Sep 17 00:00:00 2001 From: "graehl@gmail.com" Date: Mon, 2 Aug 2010 07:57:23 +0000 Subject: fake tdict names for non-ids, push viterbi cost to root in hg, store as feature. type erased fsa feature via virtual interface. made lexical_cast assume C locale for speed. git-svn-id: https://ws10smt.googlecode.com/svn/trunk@465 ec762483-ff6d-05da-a07a-a48fb63a330f --- decoder/grammar.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'decoder/grammar.h') diff --git a/decoder/grammar.h b/decoder/grammar.h index b26eb912..1173e3cd 100644 --- a/decoder/grammar.h +++ b/decoder/grammar.h @@ -25,9 +25,10 @@ struct GrammarIter { }; struct Grammar { + //TODO: HASH_MAP? typedef std::map > Cat2Rules; static const std::vector NO_RULES; - + Grammar(): ctf_levels_(0) {} virtual ~Grammar(); virtual const GrammarIter* GetRoot() const = 0; @@ -52,7 +53,7 @@ struct Grammar { protected: Cat2Rules rhs2unaries_; // these must be filled in by subclasses! std::vector unaries_; - std::string grammar_name_; + std::string grammar_name_; unsigned int ctf_levels_; }; @@ -63,17 +64,17 @@ struct TextGrammar : public Grammar { TextGrammar(); TextGrammar(const std::string& file); void SetMaxSpan(int m) { max_span_ = m; } - + virtual const GrammarIter* GetRoot() const; void AddRule(const TRulePtr& rule, const unsigned int ctf_level=0, const TRulePtr& coarse_parent=TRulePtr()); void ReadFromFile(const std::string& filename); virtual bool HasRuleForSpan(int i, int j, int distance) const; const std::vector& GetUnaryRules(const WordID& cat) const; - + private: int max_span_; boost::shared_ptr pimpl_; - + }; struct GlueGrammar : public TextGrammar { -- cgit v1.2.3