Difference between revisions of "Pattern-Action example"

From Apertium
Jump to navigation Jump to search
m (Article "Pattern-Action example")
 
m
Line 66: Line 66:
 
* The restriction <code>RL</code> has been resolved automatically.
 
* The restriction <code>RL</code> has been resolved automatically.
 
* Authors (attribute <code>a</code>) from both elements have been ''merged''.
 
* Authors (attribute <code>a</code>) from both elements have been ''merged''.
  +
  +
[[Category:Documentation]]

Revision as of 18:59, 11 July 2007

(Main article: Cross Model)

Pattern

<cross-action id="pattern-1" a="ebenimeli">
  <description>Pattern 1</description>
  <pattern>
    <e>
      <p>
        <l>lemmaA</l>
        <r>lemmaB</r>

    </e>
    <e r="RL">
      <p>
        <l>lemmaB</l>
        <r>lemmaC</r>

    </e>
  </pattern>
  <action-set>
    <action>
      <e>
        <p>
          <l>lemmaA</l>
          <r>lemmaC</r>

      </e>
    </action>
  </action-set>
</cross-action>

Candidate elements

In the example shown above, the pair of elements are candidate elements to be crossed because the lemma coixí (pillow in English) for the common language (B) is the same in both.

<!-- element in bilingual dictionary es-ca -->
<e a="author1">
  <p>
    <l>almohada</l>
    <r>coixí</r>

</e>
<!-- element in bilingual dictionary ca-fr -->
<e r="RL" a="author2">
  <p>
    <l>coixí</l>
    <r>oreiller</r>

</e>

Action

<!--
  pattern-1
-->
<e r="RL" a="author1/author2">
  <p>
    <l>almohada<s n="n"/><s n="f"/></l>
    <r>oreiller<s n="n"/><s n="m"/></r>
  </p>
</e>
  • The restriction RL has been resolved automatically.
  • Authors (attribute a) from both elements have been merged.