Difference between revisions of "Cross Model"
Jump to navigation
Jump to search
m |
|||
Line 3: | Line 3: | ||
== Cross Model == |
== Cross Model == |
||
=== |
=== Defining cross actions === |
||
⚫ | |||
Cross actions are needed to cross certain language pairs correctly. |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | * <code>$cat</code> is a variable that can store just one element (for example, <code><s n="adj"/></code>). In this example we use a variable because we need to use the value in the <code>action</code> element. Besides that, we force the value of the first <code><s n="..."/></code> element to be the same. There is another symbol (<code>?</code>) that can be used if we don't want to use the value afterwards. |
||
⚫ | |||
⚫ | |||
⚫ | |||
=== Defining additional cross actions === |
|||
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: |
||
Line 63: | Line 24: | ||
Click on each element in the schema above or read more about [[Cross Model Elements|cross model elements]]. |
Click on each element in the schema above or read more about [[Cross Model Elements|cross model elements]]. |
||
== Example of pattern-action == |
=== Example of pattern-action === |
||
=== Pattern === |
==== Pattern ==== |
||
<cross-action id="pattern-1" a="ebenimeli"> |
<cross-action id="pattern-1" a="ebenimeli"> |
||
<description>Pattern 1</description> |
<description>Pattern 1</description> |
||
Line 95: | Line 56: | ||
[[Pattern-Action example|Example]] of how this cross action could be applied. |
[[Pattern-Action example|Example]] of how this cross action could be applied. |
||
=== Default cross action === |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | * <code>$cat</code> is a variable that can store just one element (for example, <code><s n="adj"/></code>). In this example we use a variable because we need to use the value in the <code>action</code> element. Besides that, we force the value of the first <code><s n="..."/></code> element to be the same. There is another symbol (<code>?</code>) that can be used if we don't want to use the value afterwards. |
||
⚫ | |||
⚫ | |||
⚫ | |||
== See also == |
== See also == |
Revision as of 10:29, 8 February 2008
- Main article: Crossdics
Contents
Cross Model
Defining cross actions
Cross actions are needed to cross certain language pairs correctly.
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.
Default cross action
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> <p> <l>$lemmaA</l> <r>$lemmaB</r>
</e> <e> <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> </cross-model>
In the example above:
$cat
is a variable that can store just one element (for example,
). In this example we use a variable because we need to use the value in theaction
element. Besides that, we force the value of the first
element to be the same. There is another symbol (?
) that can be used if we don't want to use the value afterwards.- the symbol
*
is a sequence of 0 or more
elements. @tailA
and@tailC
are also sequences of 0 or more
elements, but, in this particular case, we store the value in a variable because we need to use it afterwards (in theaction
element).
How to use these symbols (?
,*
) and variables ($
, @
) will be explained in a new section.
See also
External links
- Full example of cross model.
- Cross model DTD