summaryrefslogtreecommitdiff
path: root/gi/scfg/abc/old_agrammar.h
diff options
context:
space:
mode:
authorlinh.kitty <linh.kitty@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-13 20:20:55 +0000
committerlinh.kitty <linh.kitty@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-13 20:20:55 +0000
commitf305e7b0e23b952fb4b7299b2607176ab7409ef9 (patch)
tree8d8d10484b7f10d1bc2a5f28b694490773ca8e6e /gi/scfg/abc/old_agrammar.h
parentc807e0b514f21a80df0268c686c7ba70fe39611a (diff)
linh added
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@241 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'gi/scfg/abc/old_agrammar.h')
-rw-r--r--gi/scfg/abc/old_agrammar.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/gi/scfg/abc/old_agrammar.h b/gi/scfg/abc/old_agrammar.h
new file mode 100644
index 00000000..d68c2548
--- /dev/null
+++ b/gi/scfg/abc/old_agrammar.h
@@ -0,0 +1,45 @@
+#ifndef _AGRAMMAR_H_
+#define _AGRAMMAR_H_
+
+#include "grammar.h"
+
+using namespace std;
+
+class aTGImpl;
+
+struct aTextGrammar : public Grammar {
+ aTextGrammar();
+ aTextGrammar(const std::string& file);
+ void SetMaxSpan(int m) { max_span_ = m; }
+
+ virtual const GrammarIter* GetRoot() const;
+ void AddRule(const TRulePtr& rule);
+ 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;
+
+ void setMaxSplit(int max_split);
+
+ void printAllNonterminals() const;
+ void addNonterminal(WordID wordID);
+
+ void splitAllNonterminals();
+ void splitNonterminal(WordID wordID);
+
+ // inline map<WordID, vector<WordID> > & getSplitNonterminals(){return splitNonterminals_;}
+ // map<WordID, vector<WordID> > splitNonterminals_;
+ private:
+ int max_span_;
+ boost::shared_ptr<aTGImpl> pimpl_;
+ int max_split_;
+
+ map<WordID, int> nonterminals_; //list of nonterminals of the grammar if nonterminals_[WordID] > 0 the nonterminal WordID is found in the grammar
+
+
+
+};
+
+
+
+
+#endif