summaryrefslogtreecommitdiff
path: root/decoder/cfg.h
diff options
context:
space:
mode:
authorgraehl@gmail.com <graehl@gmail.com@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-15 05:05:19 +0000
committergraehl@gmail.com <graehl@gmail.com@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-08-15 05:05:19 +0000
commitc142f3bde0fa673ddb3f6fc7ed3d08e71f8ff8eb (patch)
treef94444f0c7652955313135f4bdf120359324ef89 /decoder/cfg.h
parentf930e4efe2c594ac87ea650841fcb751159e909c (diff)
fixed binarization. test
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@554 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder/cfg.h')
-rwxr-xr-xdecoder/cfg.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/decoder/cfg.h b/decoder/cfg.h
index 21e03e2c..b6dd6d99 100755
--- a/decoder/cfg.h
+++ b/decoder/cfg.h
@@ -53,7 +53,7 @@ struct CFG {
o << nts[n].from << n;
}
- typedef std::pair<int,int> BinRhs;
+ typedef std::pair<WordID,WordID> BinRhs;
struct Rule {
std::size_t hash_impl() const {
@@ -144,6 +144,8 @@ struct CFG {
};
struct NT {
+ NT() { }
+ explicit NT(RuleHandle r) : ruleids(1,r) { }
std::size_t hash_impl() const { using namespace boost; return hash_value(ruleids); }
bool operator ==(NT const &o) const {
return ruleids==o.ruleids; // don't care about from
@@ -181,6 +183,7 @@ struct CFG {
void Init(Hypergraph const& hg,bool target_side=true,bool copy_features=false,bool push_weights=true);
void Print(std::ostream &o,CFGFormat const& format) const; // see cfg_format.h
void PrintRule(std::ostream &o,RuleHandle rulei,CFGFormat const& format) const;
+ void Print(std::ostream &o) const; // default format
void Swap(CFG &o) { // make sure this includes all fields (easier to see here than in .cc)
using namespace std;
swap(uninit,o.uninit);
@@ -302,5 +305,6 @@ inline void swap(CFG &a,CFG &b) {
a.Swap(b);
}
+std::ostream &operator<<(std::ostream &o,CFG const &x);
#endif