Difference between revisions of "Format dictionaries"
Jump to navigation
Jump to search
m |
ScoopGracie (talk | contribs) |
||
(13 intermediate revisions by 7 users not shown) | |||
Line 1: | Line 1: | ||
{{Otherlang|Formatage de dictionnaires|{{French}}}} |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
(''Note that the first character in the '''1line''' parameter is the digit '''1''' (one), not the lowercase "L".'') |
|||
For example, these lines: |
For example, these lines: |
||
Line 17: | Line 20: | ||
</pre> |
</pre> |
||
will be displayed in one line |
will be displayed in one line, instead of being indented to various levels on six lines: |
||
<pre> |
<pre> |
||
Line 25: | Line 28: | ||
</pre> |
</pre> |
||
This single-line format can be useful if you use [http://es.wikipedia.org/wiki/Grep grep] or any similar tool to process dictionaries. |
|||
== Aligned formatting == |
|||
You can also add two parameters, namely the positon of the <p> element and the position of the <r> element. |
|||
Here alignP = 10 and alignR = 50: |
|||
<pre> |
|||
<!-- Conjunctions - Conjunctive adverb --> |
|||
<e> <p><l>antaŭ<b/>ol<s n="cnjadv"/></l> <r>before<s n="cnjadv"/></r></p></e> |
|||
<e> <p><l>tiel<b/>ke<s n="cnjadv"/></l> <r>so<b/>that<s n="cnjadv"/></r></p></e> |
|||
<e> <p><l>krom<b/>se<s n="cnjadv"/></l> <r>unless<s n="cnjadv"/></r></p></e> |
|||
<e> <p><l>dum<s n="cnjadv"/></l> <r>whereas<s n="cnjadv"/></r></p></e> |
|||
<e> <p><l>ĉar<s n="cnjadv"/></l> <r>because<s n="cnjadv"/></r></p></e> |
|||
<e r="RL"><p><l>dum<s n="cnjadv"/></l> <r>while<s n="cnjadv"/></r></p></e> |
|||
<e> <p><l>ĝis<s n="cnjadv"/></l> <r>until<s n="cnjadv"/></r></p></e> |
|||
<e> <p><l>kiam<s n="cnjadv"/></l> <r>when<s n="cnjadv"/></r></p></e> |
|||
<e i="yes"><p><l>kiam<s n="cnjadv"/></l> <r>as<s n="cnjadv"/></r></p></e> |
|||
<e> <p><l>kiel<s n="cnjadv"/></l> <r>as<s n="cnjadv"/></r></p></e> |
|||
<e r="LR"><p><l>pro<b/>tio<b/>ke<s n="cnjadv"/></l><r>since<s n="cnjadv"/></r></p></e> |
|||
</pre> |
|||
If either value is zero or negative, no alignment will be done. |
|||
==Usage== |
|||
<pre> |
|||
Usage: apertium-dixtools format-1line [alignP alignR] <input-dic> <output-dic> |
|||
where alignP / alignR: column to align <p> and <r> entries. 0 = no indent. |
|||
Example: ' format-1line old.dix new.dix ' will give indent à la |
|||
<e><p><l>dum<s n="cnjadv"/></l><r>whereas<s n="cnjadv"/></r></p></e> |
|||
Example: ' format-1line 10 50 old.dix new.dix ' will give indent à la |
|||
<e> <p><l>dum<s n="cnjadv"/></l> <r>whereas<s n="cnjadv"/></r></p></e> |
|||
Example: ' format-1line 0 50 old.dix new.dix ' will give indent à la |
|||
<e><p><l>dum<s n="cnjadv"/></l> <r>whereas<s n="cnjadv"/></r></p></e> |
|||
Example: ' format-1line 10 0 old.dix new.dix ' will give indent à la |
|||
<e> <p><l>dum<s n="cnjadv"/></l><r>whereas<s n="cnjadv"/></r></p></e> |
|||
</pre> |
|||
⚫ | |||
[[Category:Tools]] |
[[Category:Tools]] |
||
[[Category: |
[[Category:Dixtools]] |
||
⚫ |
Latest revision as of 00:18, 24 March 2020
You can use the Apertium-dixtools package to format each <e>
tag in the dictionary.
$ apertium-dixtools format-1line <dic> <dic.out>
(Note that the first character in the 1line parameter is the digit 1 (one), not the lowercase "L".)
For example, these lines:
... <e> <p> <l>estilo<s n="n"/></l> <r>estil<s n="n"/></r> </p> </e> ...
will be displayed in one line, instead of being indented to various levels on six lines:
... <e><p><l>estilo<s n="n"/></l><r>estil<s n="n"/></r></p></e> ...
This single-line format can be useful if you use grep or any similar tool to process dictionaries.
Aligned formatting[edit]
You can also add two parameters, namely the positon of the <p> element and the position of the <r> element. Here alignP = 10 and alignR = 50:
<!-- Conjunctions - Conjunctive adverb --> <e> <p><l>antaŭ<b/>ol<s n="cnjadv"/></l> <r>before<s n="cnjadv"/></r></p></e> <e> <p><l>tiel<b/>ke<s n="cnjadv"/></l> <r>so<b/>that<s n="cnjadv"/></r></p></e> <e> <p><l>krom<b/>se<s n="cnjadv"/></l> <r>unless<s n="cnjadv"/></r></p></e> <e> <p><l>dum<s n="cnjadv"/></l> <r>whereas<s n="cnjadv"/></r></p></e> <e> <p><l>ĉar<s n="cnjadv"/></l> <r>because<s n="cnjadv"/></r></p></e> <e r="RL"><p><l>dum<s n="cnjadv"/></l> <r>while<s n="cnjadv"/></r></p></e> <e> <p><l>ĝis<s n="cnjadv"/></l> <r>until<s n="cnjadv"/></r></p></e> <e> <p><l>kiam<s n="cnjadv"/></l> <r>when<s n="cnjadv"/></r></p></e> <e i="yes"><p><l>kiam<s n="cnjadv"/></l> <r>as<s n="cnjadv"/></r></p></e> <e> <p><l>kiel<s n="cnjadv"/></l> <r>as<s n="cnjadv"/></r></p></e> <e r="LR"><p><l>pro<b/>tio<b/>ke<s n="cnjadv"/></l><r>since<s n="cnjadv"/></r></p></e>
If either value is zero or negative, no alignment will be done.
Usage[edit]
Usage: apertium-dixtools format-1line [alignP alignR] <input-dic> <output-dic> where alignP / alignR: column to align <p> and <r> entries. 0 = no indent. Example: ' format-1line old.dix new.dix ' will give indent à la <e><p><l>dum<s n="cnjadv"/></l><r>whereas<s n="cnjadv"/></r></p></e> Example: ' format-1line 10 50 old.dix new.dix ' will give indent à la <e> <p><l>dum<s n="cnjadv"/></l> <r>whereas<s n="cnjadv"/></r></p></e> Example: ' format-1line 0 50 old.dix new.dix ' will give indent à la <e><p><l>dum<s n="cnjadv"/></l> <r>whereas<s n="cnjadv"/></r></p></e> Example: ' format-1line 10 0 old.dix new.dix ' will give indent à la <e> <p><l>dum<s n="cnjadv"/></l><r>whereas<s n="cnjadv"/></r></p></e>