summaryrefslogtreecommitdiff
path: root/decoder/grammar.h
diff options
context:
space:
mode:
authorgraehl@gmail.com <graehl@gmail.com@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-02 07:57:23 +0000
committergraehl@gmail.com <graehl@gmail.com@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-02 07:57:23 +0000
commit1fc4b6a45c18b52ab2c27eb9a825ad14f31d803b (patch)
tree33eddab63ea60d0b252dc842ebd0c2a8408af40d /decoder/grammar.h
parent526efd6515eb9efdcc1fe756c3cec4981ca10186 (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.h11
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 {