summaryrefslogtreecommitdiff
path: root/decoder/tree_fragment.h
diff options
context:
space:
mode:
authorChris Dyer <redpony@gmail.com>2014-06-13 00:23:19 -0400
committerChris Dyer <redpony@gmail.com>2014-06-13 00:23:19 -0400
commit095998d0fb627808f546388491891d0ca0154787 (patch)
tree8ffeeeb1abb011c97949bc5207393e6b75e0819b /decoder/tree_fragment.h
parent3955a9607cf0e9722eb8ae3f14d951081df9f820 (diff)
tree fragment accepts StringPiece instead of string
Diffstat (limited to 'decoder/tree_fragment.h')
-rw-r--r--decoder/tree_fragment.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/decoder/tree_fragment.h b/decoder/tree_fragment.h
index 79722b5a..8bb7251a 100644
--- a/decoder/tree_fragment.h
+++ b/decoder/tree_fragment.h
@@ -8,6 +8,8 @@
#include <cassert>
#include <cstddef>
+#include "string_piece.hh"
+
namespace cdec {
class BreadthFirstIterator;
@@ -52,7 +54,7 @@ class TreeFragment {
public:
TreeFragment() : frontier_sites(), terminals() {}
// (S (NP a (X b) c d) (VP (V foo) (NP (NN bar))))
- explicit TreeFragment(const std::string& tree, bool allow_frontier_sites = false);
+ explicit TreeFragment(const StringPiece& tree, bool allow_frontier_sites = false);
void DebugRec(unsigned cur, std::ostream* out) const;
typedef DepthFirstIterator iterator;
typedef ptrdiff_t difference_type;
@@ -73,7 +75,7 @@ class TreeFragment {
// cp is the character index in the tree
// 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 std::string& tree, bool afs, unsigned cp, unsigned symp, unsigned np, unsigned* pcp, unsigned* psymp, unsigned* pnp);
+ void ParseRec(const StringPiece& tree, bool afs, unsigned cp, unsigned symp, unsigned np, unsigned* pcp, unsigned* psymp, unsigned* pnp);
public:
unsigned root;
unsigned char frontier_sites;