From e362788ec318f0d9a349eeb2459cf72747502919 Mon Sep 17 00:00:00 2001 From: Paul Baltescu Date: Thu, 7 Mar 2013 22:49:46 +0000 Subject: Parallelized grammar extraction. --- extractor/matchings_trie.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'extractor/matchings_trie.cc') 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(); } +MatchingsTrie::~MatchingsTrie() { + DeleteTree(root); +} + shared_ptr MatchingsTrie::GetRoot() const { return root; } -void MatchingsTrie::ResetTree(shared_ptr root) { +void MatchingsTrie::DeleteTree(shared_ptr root) { if (root != NULL) { for (auto child: root->children) { - ResetTree(child.second); + DeleteTree(child.second); } if (root->suffix_link != NULL) { root->suffix_link.reset(); -- cgit v1.2.3