diff --git a/libwccl/wcclfile.cpp b/libwccl/wcclfile.cpp index 0bf8f8f6c09154c533433a60f2923b59ec0fd522..22cb8edee7cbe91389bda809c3b5fbca9a85bb02 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 13f595cd0e53ab8baa3c63f26088e262cb565e25..8980c5389613859323e0f42f347f82dfee7005d3 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);