diff options
author | Paul Baltescu <pauldb89@gmail.com> | 2013-03-07 22:49:46 +0000 |
---|---|---|
committer | Paul Baltescu <pauldb89@gmail.com> | 2013-03-07 22:49:46 +0000 |
commit | e362788ec318f0d9a349eeb2459cf72747502919 (patch) | |
tree | 474f8bccf1f88a0a358094fd4d855ebc6278a2b2 /extractor/matchings_trie.cc | |
parent | b34c347cd7f4f8965e4d943543a31f9a4e886f54 (diff) |
Parallelized grammar extraction.
Diffstat (limited to 'extractor/matchings_trie.cc')
-rw-r--r-- | extractor/matchings_trie.cc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/extractor/matchings_trie.cc b/extractor/matchings_trie.cc index c7b98765..7fb7a529 100644 --- a/extractor/matchings_trie.cc +++ b/extractor/matchings_trie.cc @@ -2,19 +2,22 @@ namespace extractor { -void MatchingsTrie::Reset() { - ResetTree(root); +MatchingsTrie::MatchingsTrie() { root = make_shared<TrieNode>(); } +MatchingsTrie::~MatchingsTrie() { + DeleteTree(root); +} + shared_ptr<TrieNode> MatchingsTrie::GetRoot() const { return root; } -void MatchingsTrie::ResetTree(shared_ptr<TrieNode> root) { +void MatchingsTrie::DeleteTree(shared_ptr<TrieNode> root) { if (root != NULL) { for (auto child: root->children) { - ResetTree(child.second); + DeleteTree(child.second); } if (root->suffix_link != NULL) { root->suffix_link.reset(); |