Difference between revisions of "Cross Model"

From Apertium
Jump to navigation Jump to search
(Default pattern example added)
Line 3: Line 3:
== Cross Model ==
== Cross Model ==


By default, the <code>apertium-crossdics</code> tool uses a simple cross model (<code>schemas/cross-model.xml</code>) defining only a default pattern-action rule. However, more specific cross actions might be needed in order to cross certain language pairs correctly. Defining a new '''cross schema''' with concrete '''pattern-action''' elements solves this problem.
By default, the <code>apertium-crossdics</code> tool uses a simple cross model (<code>schemas/cross-model.xml</code>) defining only a default pattern-action rule.

<cross-model>
<cross-action id="default" a="ebenimeli">
<description>'''Default pattern'''</description>
<pattern>
<e>
$lt;p>
<l>'''$lemmaA'''<s n="'''$cat'''"/><s n="'''@tailA'''"/></l>
<r>'''$lemmaB'''<s n="'''$cat'''"/><s n="'''*'''"/></r>
</p>
</e>
<e>
$lt;p>
<l>'''$lemmaB'''<s n="'''$cat'''"/><s n="'''*'''"/></l>
<r>'''$lemmaC'''<s n="'''$cat'''"/><s n="'''@tailC'''"/></r>
</p>
</e>
</pattern>
<action-set>
<action>
<e>
$lt;p>
<l>'''$lemmaA'''<s n="'''$cat'''"/><s n="'''@tailA'''"/></l>
<r>'''$lemmaC'''<s n="'''$cat'''"/><s n="'''@tailC'''"/></r>
</p>
</e>
</action>
</action-set>
</cross-action>
</cross-model>



However, more specific cross actions might be needed in order to cross certain language pairs correctly. Defining a new '''cross schema''' with concrete '''pattern-action''' elements solves this problem.


These patterns and actions are described in XML, as follows:
These patterns and actions are described in XML, as follows:

Revision as of 09:13, 8 February 2008

Main article: Crossdics

Cross Model

By default, the apertium-crossdics tool uses a simple cross model (schemas/cross-model.xml) defining only a default pattern-action rule.

<cross-model>
  <cross-action id="default" a="ebenimeli">
    <description>Default pattern</description>
    <pattern>
      <e>
        $lt;p>
          <l>$lemmaA</l>
          <r>$lemmaB</r>

      </e>
      <e>
        $lt;p>
          <l>$lemmaB</l>
          <r>$lemmaC</r>

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

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


However, more specific cross actions might be needed in order to cross certain language pairs correctly. Defining a new cross schema with concrete pattern-action elements solves this problem.

These patterns and actions are described in XML, as follows:

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

Click on each element in the schema above or read more about cross model elements.

Example of pattern-action

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>

Example of how this cross action could be applied.

See also

External links