diff options
author | graehl@gmail.com <graehl@gmail.com@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-08-02 07:57:23 +0000 |
---|---|---|
committer | graehl@gmail.com <graehl@gmail.com@ec762483-ff6d-05da-a07a-a48fb63a330f> | 2010-08-02 07:57:23 +0000 |
commit | f9859ad4116733e145d7b8eb31c3cc9318ff7564 (patch) | |
tree | 92f6942fc7fd7066eb400bce6d2cbd2fee46c801 /decoder/grammar.h | |
parent | 6da285dfa7b0a1929dcec882d7e48a585e878d18 (diff) |
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
Diffstat (limited to 'decoder/grammar.h')
-rw-r--r-- | decoder/grammar.h | 11 |
1 files changed, 6 insertions, 5 deletions
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<WordID, std::vector<TRulePtr> > Cat2Rules; static const std::vector<TRulePtr> 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<TRulePtr> 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<TRulePtr>& GetUnaryRules(const WordID& cat) const; - + private: int max_span_; boost::shared_ptr<TGImpl> pimpl_; - + }; struct GlueGrammar : public TextGrammar { |