diff --git a/tests/datarule.cpp b/tests/datarule.cpp index 281d913d1110d4db7b4340df4845908e775fc3b7..a768770bc3639fa2909b258ab1d7da2fd0e0060f 100644 --- a/tests/datarule.cpp +++ b/tests/datarule.cpp @@ -165,29 +165,21 @@ void test_one_rule_item_actual(const rule_compare_test& c) std::ifstream is(rf.c_str()); BOOST_REQUIRE(is.good()); + boost::shared_ptr<Wccl::WcclFile> parsed; + parsed = parser.parseWcclFile(is, LIBWCCL_TEST_DATA_DIR); - boost::shared_ptr<Wccl::TagRuleSequence> rules; - boost::shared_ptr<Wccl::MatchRule> matchr; - - std::string fn = c.rule_file.filename(); - if (fn.find("match") == fn.npos) { - rules = parser.parseTagRuleSequence(is); - } else { - matchr = parser.parseMatchRule(is); - } for (size_t i = 0; i < chunk->sentences().size(); ++i) { Corpus2::Sentence::Ptr sentence = chunk->sentences()[i]->clone_shared(); Corpus2::Sentence::Ptr expected_sentence = expected->sentences()[i]; BOOST_REQUIRE_EQUAL(sentence->size(), expected_sentence->size()); - if (rules) { - rules->execute_once(sentence); - } else if (matchr) { + if (parsed->has_tag_rules()) { + parsed->get_tag_rules_ptr()->execute_once(sentence); + } + if (parsed->has_match_rules()) { boost::shared_ptr<Corpus2::AnnotatedSentence> annotated; annotated = boost::dynamic_pointer_cast<Corpus2::AnnotatedSentence>(sentence); BOOST_REQUIRE(annotated); - matchr->apply(annotated); - } else { - BOOST_ERROR("Dark forces"); + parsed->get_match_rules_ptr()->apply_all(annotated); } check_sentences(i, tagset, sentence, expected_sentence); } diff --git a/tests/rules-data/match/head/cclmatch1.ccl b/tests/rules-data/match/head/cclmatch1.ccl index 7c7aa4761633262bfa9a1855f841136462579eb9..1a2448b7280571ecad3a8e0cd53a1e6fcb0d37c3 100644 --- a/tests/rules-data/match/head/cclmatch1.ccl +++ b/tests/rules-data/match/head/cclmatch1.ccl @@ -1,3 +1,4 @@ +match_rules( apply ( match @@ -11,3 +12,4 @@ apply mark(M, M, :2, "NP") ) ) +) diff --git a/tests/rules-data/match/is/cclmatch-is1.ccl b/tests/rules-data/match/is/cclmatch-is1.ccl index d8fb4b11d82acad183328551a2e7bc31a1951226..105520d4fd7554530f8ffcbb878189faad196f76 100644 --- a/tests/rules-data/match/is/cclmatch-is1.ccl +++ b/tests/rules-data/match/is/cclmatch-is1.ccl @@ -1,3 +1,4 @@ +match_rules( apply( match( is('N_NOM') @@ -6,3 +7,4 @@ apply( mark(M, 'COPY') ) ) +) diff --git a/tests/rules-data/match/michal/cclmatch1.ccl b/tests/rules-data/match/michal/cclmatch1.ccl index d2ea62b80385cf4e2095adaae4d42b88fabbaca2..4484d6646eb64ec8a3bc993af212fbd5e240876b 100644 --- a/tests/rules-data/match/michal/cclmatch1.ccl +++ b/tests/rules-data/match/michal/cclmatch1.ccl @@ -1,3 +1,4 @@ +match_rules( apply( match( regex( base[0], 'wyżyna' ), @@ -14,3 +15,4 @@ apply( ) ) +) diff --git a/tests/rules-data/match/michal/cclmatch2.ccl b/tests/rules-data/match/michal/cclmatch2.ccl index b02d73ff33475a200388c331fbf74a0d1fc4e5f8..6734330bc0633fc7ebf94aabdb7abad2afc9b8f8 100644 --- a/tests/rules-data/match/michal/cclmatch2.ccl +++ b/tests/rules-data/match/michal/cclmatch2.ccl @@ -1,3 +1,4 @@ +match_rules( apply( @@ -13,3 +14,4 @@ apply( ) ) +) diff --git a/tests/rules-data/match/michal/cclmatch3.ccl b/tests/rules-data/match/michal/cclmatch3.ccl index 817f1b54e5077e8e8844e1bdc1267afef2e185ed..981f6d4461345efa87290728036895cb7d4da953 100644 --- a/tests/rules-data/match/michal/cclmatch3.ccl +++ b/tests/rules-data/match/michal/cclmatch3.ccl @@ -1,3 +1,4 @@ +match_rules( apply( match( is( 'city_trigger' ), @@ -10,3 +11,4 @@ apply( mark(:2, 'CITY_NAM') ) ) +) diff --git a/tests/rules-data/match/postcond/cclmatch1.ccl b/tests/rules-data/match/postcond/cclmatch1.ccl index 0e5675307e90f80483f0e8c8829ea0e613076dbb..c79419d9cd7a15fa095872c57ace047be094887c 100644 --- a/tests/rules-data/match/postcond/cclmatch1.ccl +++ b/tests/rules-data/match/postcond/cclmatch1.ccl @@ -1,3 +1,4 @@ +match_rules( apply( match( inter( base[0], 'wyżyna' ), @@ -12,3 +13,4 @@ apply( mark(:2, 'Highland') ) ) +) diff --git a/tests/rules-data/match/postcond/cclmatch2.ccl b/tests/rules-data/match/postcond/cclmatch2.ccl index 3f2b4555dc297efa3db3087682bd4743589f5deb..49d4619e87f0e5c2ca06b95c67061b8f791b2f43 100644 --- a/tests/rules-data/match/postcond/cclmatch2.ccl +++ b/tests/rules-data/match/postcond/cclmatch2.ccl @@ -1,3 +1,4 @@ +match_rules( apply( match( inter( base[0], 'wyżyna' ), @@ -12,3 +13,4 @@ apply( mark(:2, 'Highland') ) ) +) diff --git a/tests/rules-data/match/postcond2/cclmatch-none.ccl b/tests/rules-data/match/postcond2/cclmatch-none.ccl index 594b8220a2e47015de18115cfe49527c1ab1024d..0f40aee78ab354d3f5393720d3032e31e09fca83 100644 --- a/tests/rules-data/match/postcond2/cclmatch-none.ccl +++ b/tests/rules-data/match/postcond2/cclmatch-none.ccl @@ -1,3 +1,4 @@ +match_rules( apply( match( is("A") @@ -9,3 +10,4 @@ apply( mark(M, "C") ) ) +) diff --git a/tests/rules-data/match/postcond2/cclmatch2.ccl b/tests/rules-data/match/postcond2/cclmatch2.ccl index 75f7fb464df2ee63d1c6be79a18a70c328384343..5bffeca02787f93984cc849f20ba2e1a07335351 100644 --- a/tests/rules-data/match/postcond2/cclmatch2.ccl +++ b/tests/rules-data/match/postcond2/cclmatch2.ccl @@ -1,3 +1,4 @@ +match_rules( apply( match( is("B") @@ -9,3 +10,4 @@ apply( mark(M, "C") ) ) +) diff --git a/tests/rules-data/match/postcond2/cclmatch3.ccl b/tests/rules-data/match/postcond2/cclmatch3.ccl index d9c9f33d9d44fdba0310c03668c9be576b2e2756..3be90c9a6f782df3f49d6ee57e516cb46ab4bf6a 100644 --- a/tests/rules-data/match/postcond2/cclmatch3.ccl +++ b/tests/rules-data/match/postcond2/cclmatch3.ccl @@ -1,5 +1,7 @@ +match_rules( apply( match(repeat(equal(class[0], adj))), cond(ann(M, "B")), actions(mark(M,"C")) ) +) diff --git a/tests/rules-data/match/postcond2/cclmatch4.ccl b/tests/rules-data/match/postcond2/cclmatch4.ccl index 6e68f17b1d2c177c43cc34d4298a8dbea44465c0..f0f132b72d303d2f0efba711657349796d78bd19 100644 --- a/tests/rules-data/match/postcond2/cclmatch4.ccl +++ b/tests/rules-data/match/postcond2/cclmatch4.ccl @@ -1,5 +1,7 @@ +match_rules( apply( match(repeat(equal(class[0], adj))), cond(annsub(M, "B")), actions(mark(M,"C")) ) +) diff --git a/tests/rules-data/match/postcond2/cclmatch5.ccl b/tests/rules-data/match/postcond2/cclmatch5.ccl index 51ff9f06e57b7557a4c43747d7ee2cf593d56156..03b1f33b4d95664899a6db4b75d6ef983d257316 100644 --- a/tests/rules-data/match/postcond2/cclmatch5.ccl +++ b/tests/rules-data/match/postcond2/cclmatch5.ccl @@ -1,3 +1,4 @@ +match_rules( apply( match( repeat( @@ -12,3 +13,4 @@ apply( //cond(debug(orth[first(M)])), actions(mark(M,"C")) ) +) diff --git a/tests/rules-data/match/postcond3/cclmatch1.ccl b/tests/rules-data/match/postcond3/cclmatch1.ccl index e69473a7ba46067543fd0dc88e763e8850c536a6..02d993931502ca547f36af656dbbeaa47a4591b9 100644 --- a/tests/rules-data/match/postcond3/cclmatch1.ccl +++ b/tests/rules-data/match/postcond3/cclmatch1.ccl @@ -1,3 +1,4 @@ +match_rules( apply( match( optional(repeat(inter(class[0], {adj}))), @@ -10,3 +11,4 @@ apply( mark(M, "NP") ) ) +) diff --git a/tests/rules-data/match/postcond3/cclmatch2.ccl b/tests/rules-data/match/postcond3/cclmatch2.ccl index d8d9560b59da2f5dbb8a374db0f47d0296423f4d..7e4251ca90b4a2f8f143164f303f61fc8cf5dd12 100644 --- a/tests/rules-data/match/postcond3/cclmatch2.ccl +++ b/tests/rules-data/match/postcond3/cclmatch2.ccl @@ -1,3 +1,4 @@ +match_rules( apply( match( optional(repeat(inter(class[0], {adj}))), @@ -10,3 +11,4 @@ apply( mark(M, "NP") ) ) +) diff --git a/tests/rules-data/match/repeat/cclmatch3.ccl b/tests/rules-data/match/repeat/cclmatch3.ccl index 81cf3c67ad32dddd771f9598a961f16d2b5a01d7..64479cf0fec9e11a02d6c75523fe0a2ab39ac7fc 100644 --- a/tests/rules-data/match/repeat/cclmatch3.ccl +++ b/tests/rules-data/match/repeat/cclmatch3.ccl @@ -1,3 +1,4 @@ +match_rules( apply( match( optional(repeat(inter(class[0], {adj, pact, ppas}))), @@ -7,3 +8,4 @@ apply( mark(M, 'NP') ) ) +) diff --git a/tests/rules-data/match/repeat/cclmatch4.ccl b/tests/rules-data/match/repeat/cclmatch4.ccl index 68a50fadac34bf64c6b521de63cc9b2c8850859a..908fe7aa8bb3d054c38f9d40cc3cd86c8a1a18d1 100644 --- a/tests/rules-data/match/repeat/cclmatch4.ccl +++ b/tests/rules-data/match/repeat/cclmatch4.ccl @@ -1,3 +1,4 @@ +match_rules( apply( match( repeat( @@ -10,3 +11,4 @@ apply( mark(M, 'MultiNP') ) ) +) diff --git a/tests/rules-data/match/single_tok/cclmatch1.ccl b/tests/rules-data/match/single_tok/cclmatch1.ccl index 0ee107574ecd4050814d839cf4a78fd2d3e5efcd..30cf289fb7e0f773a7c0b4db23be4b2154a6a987 100644 --- a/tests/rules-data/match/single_tok/cclmatch1.ccl +++ b/tests/rules-data/match/single_tok/cclmatch1.ccl @@ -1,3 +1,4 @@ +match_rules( apply( match( and( inter(class[0], {subst, ger, depr}), inter(cas[0], {nom}) ) @@ -6,3 +7,4 @@ apply( mark($m:_M, 'N_NOM') ) ) +) diff --git a/tests/rules-data/match/text/cclmatch1.ccl b/tests/rules-data/match/text/cclmatch1.ccl index 9b1ed19378eb9d0def185a6818decd41bb4fc98d..11b260128c511993873e39bfe601016967e50f6b 100644 --- a/tests/rules-data/match/text/cclmatch1.ccl +++ b/tests/rules-data/match/text/cclmatch1.ccl @@ -1,3 +1,4 @@ +match_rules( apply( match( text("Sp. z o.o.") @@ -6,3 +7,4 @@ apply( mark(M, "Co") ) ) +) diff --git a/tests/rules-data/match/text/cclmatch2.ccl b/tests/rules-data/match/text/cclmatch2.ccl index 96885ffbb7bb4f741af3621a95b4d4a21518b96f..efd2764d4f6cd78558d2726e200402a82f764b1e 100644 --- a/tests/rules-data/match/text/cclmatch2.ccl +++ b/tests/rules-data/match/text/cclmatch2.ccl @@ -1,3 +1,4 @@ +match_rules( apply( match( text("Sp."), @@ -10,3 +11,4 @@ apply( mark(:3, "O") ) ) +) diff --git a/tests/rules-data/match/unmark/cclmatch1.ccl b/tests/rules-data/match/unmark/cclmatch1.ccl index 445daca59cbd42aa6e932bc6e83130d1e6cececd..46448bb76d93ddd22ddf6648d5a38a890e378bc3 100644 --- a/tests/rules-data/match/unmark/cclmatch1.ccl +++ b/tests/rules-data/match/unmark/cclmatch1.ccl @@ -1,3 +1,4 @@ +match_rules( apply( match( optional(equal(class[0], other)), @@ -7,3 +8,4 @@ apply( unmark(M, "A") ) ) +) diff --git a/tests/rules-data/match/unmark/cclmatch2.ccl b/tests/rules-data/match/unmark/cclmatch2.ccl index c81f1a1fca1ab514da44ed87160cf66f1bb6d5c2..626115606527e169f8a5c18205c5711ea0f07d0a 100644 --- a/tests/rules-data/match/unmark/cclmatch2.ccl +++ b/tests/rules-data/match/unmark/cclmatch2.ccl @@ -1,3 +1,4 @@ +match_rules( apply( match( optional(equal(class[0], other)), @@ -7,3 +8,4 @@ apply( unmark(M, "B") ) ) +) diff --git a/tests/rules-data/match/variants/cclmatch1.ccl b/tests/rules-data/match/variants/cclmatch1.ccl index 5e4efc1b1ae12cc59b9b0390d4bcefcffdad3ab0..953c83fb58b19b4355f7079931b50ecdcf448061 100644 --- a/tests/rules-data/match/variants/cclmatch1.ccl +++ b/tests/rules-data/match/variants/cclmatch1.ccl @@ -1,3 +1,4 @@ +match_rules( apply( match( longest( @@ -16,3 +17,4 @@ apply( actions(mark(M, "C")) ) +) diff --git a/tests/rules-data/match/variants/cclmatch2.ccl b/tests/rules-data/match/variants/cclmatch2.ccl index bb5fdaaec67fb1dbdb806eafdbbaa1c23a29c27e..ac9021d7f7b8258191b95cbc346ac8b8623ac6ea 100644 --- a/tests/rules-data/match/variants/cclmatch2.ccl +++ b/tests/rules-data/match/variants/cclmatch2.ccl @@ -1,3 +1,4 @@ +match_rules( apply( match( oneof( @@ -16,3 +17,4 @@ apply( actions(mark(M, "C")) ) +)