Cross Model Elements

From Apertium
Jump to: navigation, search

En français

Main article: Cross Model

Contents

[edit] cross-model element

cross-model element is a set of cross actions (cross-action elements).

<!DOCTYPE cross-model SYSTEM "crossmodel.dtd">
<cross-model>
  <cross-action id="pattern-1" a="author">
  ...
  </cross-action>
  <cross-action id="pattern-2" a="author">
  ...
  </cross-action>
  ...
  <cross-action id="pattern-n" a="author">
  ...
  </cross-action>
</cross-model>

[edit] cross-action element

Each cross actions consists of a pair (pattern,action-set).

<cross-action id="pattern-1" a="author">
  <description>Cross action 1</description>
  <pattern>
    ...
  </pattern>
  <action-set>
    <action>
      ...
    </action>
    ...
    <action>
      ...
    </action>
  </action-set>
</cross-action>

[edit] pattern element

<pattern>
  <!-- Element in bilingual dictionary AB-->
  <e>
    <p>
      <l>$lemmaA<s n="..."/>...<s n="..."/></l>
      <r>$lemmaB<s n="..."/>...<s n="..."/></r>
    </p>
  </e>
  <!-- Element in bilingual dictionary BC-->
  <e r="RL">
    <p>
      <l>$lemmaB<s n="n"/>...<s n="..."/></l>
      <r>$lemmaC<s n="n"/>...<s n="..."/></r>
    </p>
  </e>
</pattern>

[edit] action-set element

The action-set element is a list of actions to be performed when a pair of candidate elements matches the pattern.

<action-set>
  <action>
    <e>
      <p>
        <l>$lemmaA<s n="n"/><s n="..."/>...<s n="..."/></l>
        <r>$lemmaC<s n="n"/><s n="..."/>...<s n="..."/></r>
      </p>
    </e>
  </action>
  <action>
  ...
  </action>
</action-set>

[edit] Values for <s> element

[edit] Literals

<e>
  <p>
    <r>$lemmaA<s n="adj"/></l>
    <r>$lemmaB<s n="adj"/></r>
  </p>
</e>

Use literals (as in <s n="adj"/>) to match exactly that element.

[edit] Variables

There are two types of variables:

  • <v n="..."/> tag: one <s> element. For example, <v n="cat"/> can refer to <s n="adj"/>. Value "adj" will be stored in variable "cat".
  • <t n="..."/> tag: is used to indicate a sequence of <s> elements. In this case, <t n="tail"/>, can refer to the sequence <s n="n"/><s n="m"/><s n="sg"/>. Sequence "n.m.sg" will be stored in variable "tail".

Example:

<e>
  <p>
    <l>$lemmaA<v n="cat"/><t n="tailA"/></l>
    <r>$lemmaB<v n="cat"/><t/></r>
  </p>
</e>

If you are not using the value of <v...> or <t...>, do not define any n attribute, that is:

  • <v/>: 1 <s n="..."/> element.
  • <t/>: 0 or more <s n="..."/> element(s).

Example:

<e>
  <p>
    <l>$lemmaA<s n="n"/><v/><s n="sg"/></l>
    <r>$lemmaB<s n="n"/><t/></r>
  </p>
</e>

In the example above, <v/> might be either <s n="m"/>, <s n="f"/>, etc, but the value is not stored in a variable because it's not used in any other place in the cross action.

Personal tools