Closed ftyers closed 4 years ago
Current syntax for that is
<choose>
<when>
<test>
<not>
<equal><clip pos="1" side="tl" part="a_agr_subj"/><clip pos="1" side="tl" part="a_agr_subj"/></equal>
</not>
</test>
<reject-current-rule/>
</when>
</choose>
But something like <assert>
would definitely be doable.
Hmm, that syntax is a bit verbose, even for XML and even for me! Also it seems to make something procedural (if then) where I think it should be declarative. Also, it shouldn't be part of the action.
Would it take long to implement it?
Would it take long to implement it?
10 minutes, apparently. :)
If an <assert>
contains multiple clauses or there are multiple <assert>
s, they will be AND
ed together and they must all precede the <action>
.
<assert>
may contain anything that could appear in <test>
.
AND
and yeah, basically anything in <test>
<rule comment="SV SD" firstChunk="S">
<pattern>
<pattern-item n="SV"/>
<pattern-item n="SD"/>
</pattern>
<assert>
<equal><clip pos="1" side="tl" part="a_agr_subj"/><clip pos="2" side="tl" part="a_agr_subj"/></equal>
</assert>
<action>
<call-macro n="f_set_chunk_name1"><with-param pos="1"/></call-macro>
<call-macro n="f_concord_subj2"><with-param pos="1"/><with-param pos="2"/></call-macro>
<out>
<chunk namefrom="chunkName">
<tags>
<tag><lit-tag v="S.tv"/></tag>
<tag><clip pos="1" side="sl" part="a_agr_subj"/></tag>
<tag><clip pos="1" side="sl" part="a_agr_obj"/></tag>
</tags>
<lu> <clip pos="2" side="tl" part="whole"/> </lu>
<b/>
<lu> <clip pos="1" side="tl" part="whole"/> </lu>
</chunk>
</out>
</action>
</rule>
but:
fran@ipek:~/source/apertium/pairs/apertium-quc-spa$ make
trx-comp quc-spa.rtx.bin apertium-quc-spa.quc-spa.rtx
Error in apertium-quc-spa.quc-spa.rtx on line 830: Unrecognized condition 'text'
Makefile:837: recipe for target 'quc-spa.rtx.bin' failed
make: *** [quc-spa.rtx.bin] Error 1
I should be on the latest version:
commit f11e6166afb33807d94e921a935e8ebfbcca2761 (HEAD -> master, origin/master, origin/HEAD)
Author: Daniel Swanson <popcorn.tomato.dude@gmail.com>
Date: Mon Jul 6 11:27:39 2020 -0400
add <assert> in trx - #58
Typo on my part - trying to skip spaces on the wrong element.
It might be a nice idea to be able to have rules which only apply if certain conditions apply, e.g. "only apply this rule if the subject of V¹ agrees with the subject of V²". Potentially something like
<assert>
?