Difference between revisions of "Paths to rule blocked"

From Apertium
Jump to navigation Jump to search
 
Line 11: Line 11:


==How to avoid==
==How to avoid==
If you have a rule for nom.prop.gen followed by one for nom.gen, defined as
If you have e.g. a rule for nom.prop.gen followed by one for nom.gen:
<pre>
<pre>
<def-cat n="nom.gen">
<def-cat n="nom.gen">
Line 20: Line 20:
<cat-item tags="np.*.gen.*"/>
<cat-item tags="np.*.gen.*"/>
</def-cat>
</def-cat>
<rule><pattern><pattern-item n="nom.gen"/>…</rule>
<rule><pattern><pattern-item n="nom.prop.gen"/>…</rule>
</pre>
</pre>


then the first will block the second *for the proper nouns* (though not for non-proper nouns). To avoid the warning, simply define a
then the first rule block the second rule ''for the proper nouns'' (though non-proper nouns will still be handled by the first rule).

To avoid the warning, simply define a
<pre>
<pre>
<def-cat n="nom.unprop.gen">
<def-cat n="nom.unprop.gen">
Line 28: Line 34:
</def-cat>
</def-cat>
</pre>
</pre>
and use that in the second rule.
and use that in the second rule. The behaviour will be the same.


==When it's OK==
==When it's OK==

Latest revision as of 19:29, 13 December 2016

If you get

Warning (753): Paths to rule 5 blocked by rule 3.

from apertium-preprocess-transfer (or make), then you can check out the relevant rules by doing e.g.

$ xmllint --xpath '//rule[3]' apertium-dan-nor.nor-dan.t1x
$ xmllint --xpath '//rule[5]' apertium-dan-nor.nor-dan.t1x

(exchanging apertium-dan-nor.nor-dan.t1x for your transfer file)

How to avoid[edit]

If you have e.g. a rule for nom.prop.gen followed by one for nom.gen:

    <def-cat n="nom.gen">
      <cat-item tags="n.*.gen.*"/>
      <cat-item tags="np.*.gen.*"/>
    </def-cat>
    <def-cat n="nom.prop.gen">
      <cat-item tags="np.*.gen.*"/>
    </def-cat>
…
    <rule><pattern><pattern-item n="nom.gen"/>…</rule>
…
    <rule><pattern><pattern-item n="nom.prop.gen"/>…</rule>

then the first rule block the second rule for the proper nouns (though non-proper nouns will still be handled by the first rule).

To avoid the warning, simply define a

    <def-cat n="nom.unprop.gen">
      <cat-item tags="n.*.gen.*"/>
    </def-cat>

and use that in the second rule. The behaviour will be the same.

When it's OK[edit]

For "catch-all" rules, it's fine if there is some overlap.