Difference between revisions of "Cross Model"
Jump to navigation
Jump to search
(→Pattern: --> new notation) |
(→Default cross action: --> new notation) |
||
| Line 66: | Line 66: | ||
<e> |
<e> |
||
<p> |
<p> |
||
<l>'''$lemmaA'''< |
<l>'''$lemmaA'''<v n="'''cat'''"/><t n="'''tailA'''"/></l> |
||
<r>'''$lemmaB'''< |
<r>'''$lemmaB'''<v n="'''cat'''"/><t/></r> |
||
</p> |
</p> |
||
</e> |
</e> |
||
<e> |
<e> |
||
<p> |
<p> |
||
<l>'''$lemmaB'''< |
<l>'''$lemmaB'''<v n="'''cat'''"/><t/></l> |
||
<r>'''$lemmaC'''< |
<r>'''$lemmaC'''<v n="'''cat'''"/><t n="'''tailC'''"/></r> |
||
</p> |
</p> |
||
</e> |
</e> |
||
| Line 81: | Line 81: | ||
<e> |
<e> |
||
<p> |
<p> |
||
<l>'''$lemmaA'''< |
<l>'''$lemmaA'''<v n="'''cat'''"/><t n="'''tailA'''"/></l> |
||
<r>'''$lemmaC'''< |
<r>'''$lemmaC'''<v n="'''cat'''"/><t n="'''tailC'''"/></r> |
||
</p> |
</p> |
||
</e> |
</e> |
||
Revision as of 10:12, 10 March 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<v n="X"/></l>
<r>$lemmaB<v n="Y"/></r>
</e>
<e r="RL">
<p>
<l>$lemmaB</l>
<r>$lemmaC</r>
</e>
</pattern>
<action-set>
<action>
<e>
<p>
<l>$lemmaA<v n="X"/></l>
<r>$lemmaC<v n="Y"/></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<v n="cat"/><t n="tailA"/></l>
<r>$lemmaB<v n="cat"/><t/></r>
</e>
<e>
<p>
<l>$lemmaB<v n="cat"/><t/></l>
<r>$lemmaC<v n="cat"/><t n="tailC"/></r>
</e>
</pattern>
<action-set>
<action>
<e>
<p>
<l>$lemmaA<v n="cat"/><t n="tailA"/></l>
<r>$lemmaC<v n="cat"/><t n="tailC"/></r>
</e>
</action>
</action-set>
</cross-action>
</cross-model>
In the example above:
$catis 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 theactionelement. Besides that, we force the value of the firstelement 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 moreelements. @tailAand@tailCare also sequences of 0 or moreelements, but, in this particular case, we store the value in a variable because we need to use it afterwards (in theactionelement).
How to use these symbols (?,*) and variables ($, @) is explained in the section Cross Model Elements
See also
External links
- Full example of cross model.
- Cross model DTD