Difference between revisions of "Lttoolbox/Direction"

From Apertium
Jump to navigation Jump to search
Line 10: Line 10:


When using <code>lt-expand</code>, an entry with <code>r="LR"</code> in the .dix will get <code>:>:</code> between the l and r when expanding, RL gets <code>:<:</code>, others get <code>:</code>.
When using <code>lt-expand</code>, an entry with <code>r="LR"</code> in the .dix will get <code>:>:</code> between the l and r when expanding, RL gets <code>:<:</code>, others get <code>:</code>.

In <code>.lexc</code> dictionaries, for historical reasons, <code>LR</code> and <code>RL</code> has the same effect as regards analysis or generation — RL means "only generate" and LR means "only analyse this form". But in a <code>.lexc</code> file, unlike <code>.dix</code> files, the lexical side is on the left, thus "left-to-right" and "right-to-left" terms shouldn't be taken literally.

[[Category: Lttoolbox]]
[[Category: Lttoolbox]]
[[Category: Writing dictionaries]]
[[Category: Writing dictionaries]]

Revision as of 22:59, 4 April 2019

r="LR" in an lttoolbox .dix file means "only include this entry when compiling from left-to-right" (lt-comp lr foo.dix foo.bin). Similarly, r="RL" in an lttoolbox .dix file means "only include when compiling from right-to-left".

In a monolingual dictionary, LR is used when several forms have the same analysis, but only one should be generated; e.g. if you want "colour" and "color" to have the same analysis <code>colour<n><sg></code>, but only "colour" to be generated, you would put r="LR" on "color".

An RL restriction is used in monodix for forms that should only be generated; one example would be where a single monodix is used for two language pairs which have slightly different tagsets, we might put an RL on an entry that's got the non-standard tagging; another example is when translating e.g. an adverb into some phrase that doesn't quite exist as a single adverb in the target language, we might put an RL on the entry since it shouldn't be analysed when translating into other languages.


In bidix, LR and RL are used when you want to translate only from the one language to the other. If the bidix has <code><l></code> for Spanish and <code><r></code> for Catalan, then any entries marked LR will only be included when you compile it "lr", from Spanish to Catalan (and RL entries are ignored). Similarly, RL entries are only included when you compile it "rl", from Catalan to Spanish (and LR entries are ignored).


When using lt-expand, an entry with r="LR" in the .dix will get :>: between the l and r when expanding, RL gets :<:, others get :.

In .lexc dictionaries, for historical reasons, LR and RL has the same effect as regards analysis or generation — RL means "only generate" and LR means "only analyse this form". But in a .lexc file, unlike .dix files, the lexical side is on the left, thus "left-to-right" and "right-to-left" terms shouldn't be taken literally.