From 1923cc70354911518993b604e2b74b2fa99a0de7 Mon Sep 17 00:00:00 2001 From: ilor <ilor@vger.(none)> Date: Mon, 9 May 2011 13:10:18 +0200 Subject: [PATCH] add missing getter impl in wcclfile, fix wccl-rules --- libwccl/wcclfile.cpp | 8 ++++++++ wccl-apps/wccl-rules.cpp | 4 +--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/libwccl/wcclfile.cpp b/libwccl/wcclfile.cpp index 0bf8f8f..22cb8ed 100644 --- a/libwccl/wcclfile.cpp +++ b/libwccl/wcclfile.cpp @@ -36,6 +36,14 @@ boost::shared_ptr<const TagRuleSequence> WcclFile::get_tag_rules_ptr() const return tag_rules_; } +boost::shared_ptr<MatchRuleSequence> WcclFile::get_match_rules_ptr() +{ + if (!has_match_rules()) { + throw WcclError("There are no match rules."); + } + return match_rules_; +} + boost::shared_ptr<const MatchRuleSequence> WcclFile::get_match_rules_ptr() const { if (!has_match_rules()) { diff --git a/wccl-apps/wccl-rules.cpp b/wccl-apps/wccl-rules.cpp index 13f595c..8980c53 100644 --- a/wccl-apps/wccl-rules.cpp +++ b/wccl-apps/wccl-rules.cpp @@ -125,9 +125,7 @@ void RuleRunner::apply_rules(boost::shared_ptr<Corpus2::TokenReader> reader, } else { f->get_tag_rules_ptr()->execute_until_done(as, tag_rule_iterations_); } - foreach (const boost::shared_ptr<Wccl::MatchRule>& mr, f->get_match_rules()) { - mr->apply(as); - } + f->get_match_rules_ptr()->apply_all(as); } timer.count_sentence(*as); -- GitLab