diff --git a/examples/ne-match.ccl b/examples/ne-match.ccl new file mode 100644 index 0000000000000000000000000000000000000000..1129219e8ba2f0e52913d5fa6dc2bc6927e73676 --- /dev/null +++ b/examples/ne-match.ccl @@ -0,0 +1,54 @@ +match_rules( + + // „wyżyna Xâ€, gdzie X jest oznaczone anotacjÄ… reladj_gaz_based + // poza tym wymagane jest uzgodnienie + apply( + match( + regex( base[0], 'wyżyna' ), + is( 'reladj_gaz_based' ) + ), + cond( + ann(:1, 'capitalized_noun' ), + agr(first(:1), first(:2), {nmb,gnd,cas}) + //equal( nmb[first(:1)], nmb[first(:2)] ), + //equal( cas[first(:1)], cas[first(:2)] ), + //equal( gnd[first(:1)], gnd[first(:2)] ) + ), + actions( + mark(M, 'HIGHLAND_NAM') + ) + ); + + // „wyżyna Xâ€, gdzie X może być subst i może być nom + // znakuje drugi element jako HIGHLAND_NAM, + // pierwszy element nie może być oznakowany jako capitalized_noun + apply( + match( + regex( base[0], 'wyżyna'), + and( inter(class[0], {subst}), inter(cas[0], {nom}) ) + ), + cond( + not( ann(:1, 'capitalized_noun' ) ) + ), + actions( + mark(:2, 'HIGHLAND_NAM') + ) + ); + + // „MIASTO Yâ€, gdzie MIASTO to anotacja city_trigger (jedno lub wielotokenowa), + // a Y to first_capital_word, poza tym mamy post-condition, że Y nie zawiera siÄ™ + // w anotacji city_nam_gaz + apply( + match( + is( 'city_trigger' ), + is( 'first_capital_word' ) + ), + cond( + not( annsub(:2, 'city_nam_gaz') ) + ), + actions( + mark(:2, 'CITY_NAM') + ) + ) + +) diff --git a/libwccl/parser/grammar.g b/libwccl/parser/grammar.g index c6958c7d7ddb83c66f44e0a022d9d0952211f628..f342038bb7c8fec032db8cc17222478275fa8e08 100644 --- a/libwccl/parser/grammar.g +++ b/libwccl/parser/grammar.g @@ -282,7 +282,6 @@ parse_match_rule { Lexicons empty_lex; ParsingScope scope(tagset, empty_lex); - scope.variables().get_put<Match>("_M"); } : ret_match = match_rule_operator[scope] ; @@ -2325,6 +2324,7 @@ match_rule_operator returns [boost::shared_ptr<MatchRule> ret_op] { boost::shared_ptr<ApplyOperator> apply; + scope.variables().get_put<Match>("_M"); } : apply = match_apply_operator [scope] { ret_op = boost::make_shared<MatchRule>(scope.variables(), apply);