diff options
author | Patrick Simianer <p@simianer.de> | 2014-07-04 13:32:22 +0200 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2014-07-04 13:32:22 +0200 |
commit | 49671a7f685eb364f7735f4bbda0c05a2dbfe76c (patch) | |
tree | ac4a20c1e1112ccf8e2f7b61ea66ca31152ac9c0 /decoder/tree_fragment.h | |
parent | 48027e9eeebda4f8506c00ff259fb3426149f85b (diff) | |
parent | d124d4aaa78b52b46f7ac8d7306be342d3405124 (diff) |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'decoder/tree_fragment.h')
-rw-r--r-- | decoder/tree_fragment.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/decoder/tree_fragment.h b/decoder/tree_fragment.h index 8bb7251a..6b4842ee 100644 --- a/decoder/tree_fragment.h +++ b/decoder/tree_fragment.h @@ -43,9 +43,10 @@ inline bool IsTerminal(unsigned x) { struct TreeFragmentProduction { TreeFragmentProduction() {} - TreeFragmentProduction(int nttype, const std::vector<unsigned>& r) : lhs(nttype), rhs(r) {} + TreeFragmentProduction(int nttype, const std::vector<unsigned>& r) : lhs(nttype), rhs(r), span(std::make_pair<short,short>(-1,-1)) {} unsigned lhs; std::vector<unsigned> rhs; + std::pair<short, short> span; // the span of the node (in input, or not set for rules) }; // this data structure represents a tree or forest @@ -76,6 +77,10 @@ class TreeFragment { // np keeps track of the nodes (nonterminals) that have been built // symp keeps track of the terminal symbols that have been built void ParseRec(const StringPiece& tree, bool afs, unsigned cp, unsigned symp, unsigned np, unsigned* pcp, unsigned* psymp, unsigned* pnp); + + // used by constructor to set up span indices for logging/alignment purposes + int SetupSpansRec(unsigned cur, int left); + public: unsigned root; unsigned char frontier_sites; |