Difference between revisions of "Starting a new language with lttoolbox"

From Apertium
Jump to navigation Jump to search
m (Reverted edits by Matiss (Talk) to last revision by Francis Tyers)
Line 1: Line 1:
 
{{TOCD}}
 
{{TOCD}}
  +
:''For information on how to install lttoolbox, see [[lttoolbox]] and [[minimal installation from SVN]]''
   
  +
This page is going to describe how to start a new language with [[lttoolbox]]. As lttoolbox is not really suited to agglutinative languages, or languages with complex and regular morphophonology (or at least no-one has written a dictionary from scratch using lttoolbox for one of these languages yet), we're going to work on one with simpler and less regular morphology. We particularly encourage people to use lttoolbox wherever possible; it has a straightforward syntax, has some very useful features for validation and is a canonical part of Apertium, not requiring any special software to be installed.
:''Информация о том, как установить lttoolbox смотрите [[lttoolbox]] и[[minimal installation from
 
SVN]]''
 
   
  +
==Preliminaries==
Здесь мы объясним, как изучать новый язык с [[lttoolbox]]. lttoolbox на самом деле не подходит
 
для агглютинативных языков, или языков со сложной и регулярной морфо-фонологиыой (или по
 
крайней мере никто не написал словарь с нуля, используя lttoolbox для одного из этих языков), мы
 
будем работать над таким с языком с простой и менее регулярной морфологийой. В частности,
 
мы рекомендуем людям использовать lttoolbox возможности; lttoolbox имеет простой синтаксис,
 
есть несколько очень полезных функций для проверки и является канонической частью Apertium,
 
не требующий никакого специального программного обеспечения для установки.
 
   
  +
A morphological transducer in lttoolbox has typically one file, a <code>.dix</code> file. This defines both how morphemes in the language are joined together, ''morphotactics'', and how changes happen when these morphemes are joined together, ''morphographemics'' (or ''morphophonology''). For example,
== Подготовка==
 
   
  +
* Morphotactics: wolf<n><pl> → wolf + s
Морфологических переводчик в lttoolbox имеет обычно один файл, <code>.dix</code> файл.
 
  +
* Morphographemics: wolf + s → wolves
Это определяет как морфемы в языке соединяются вместе,''морфотактики'', и как изменения
 
происходят, когда эти морфемы соединяются вместе, ''морфографемика''(или''морфофонология'').
 
Например,
 
   
  +
These two phenomena are treated in the same file.
* морфотактика: wolf<n><pl> → wolf + s
 
   
  +
==The language==
* морфографемика: wolf + s → wolves
 
   
  +
The language we will be modelling is Upper Sorbian, a Slavic language spoken in Germany. There is a limited grammar available in English [http://serbscina.w.interia.pl/iso/eindex.htm here], and that is what we will be basing our analysis on. The part of speech we're going to look at for this small tutorial is nouns. Nouns in Upper Sorbian have seven cases (nominative, genitive, dative, accusative, locative, instrumental, vocative), three numbers (singular, dual, plural) and three genders (masculine, feminine, neuter). Like other Slavic languages, the category of animacy is distinguished in the masculine.<ref>This description is simplistic; the reality is more complicated, but it will do for a tutorial.</ref>
Эти два рассматриваются в том же файле.
 
   
== Язык==
+
===Paradigms===
   
  +
Here we give four example paradigms; these will form the basis of our implementation.
Язык которий мы будем моделировать- Верхний сербский, славянский язык на котором
 
говорят в Германии. Существует ограниченная грамматика на английском языке [http:/
 
/serbscina.w.interia.pl/iso/eindex.htm здесь], и это то, что мы будем использовать для
 
нашего анализа.Часть речи, на которую мы будем смотреть в этой небольшой инструкции-
 
существительные . Существительные в Верхней сербский семь падежей (именительный,
 
родительный, дательный, винительный, местный, инструментальные, звательный), три числа
 
(единственное, двойственное, множественное) и три рода (мужской, женский, средний). Как и в
 
других славянских языках, категории одушевленность выделяется в мужской <ref> Это описание
 
   
  +
;Masculine animate (''nan'' "father")
является упрощенным. Реальность сложнее, но это достаточна на этот раз </ref>.
 
 
=== парадигмы ===
 
 
Здесь мы дадим четыре парадигмы, эти станут основой реализации нашего достижения.
 
 
; живой мужского рода (''nan'' " отец ")
 
   
 
{|class=wikitable
 
{|class=wikitable
  +
! !! Singular !! Dual !! Plural
 
!! единственное число
 
 
!
 
 
 
|-
 
|-
  +
| Nominative || nan || nan'''aj''' || nan'''ojo'''
 
| Именительный
 
 
 
|-
 
|-
  +
| Genitive || nan'''a''' || nan'''ow''' || nan'''ow'''
 
| Родительный
 
 
 
|-
 
|-
  +
| Dative || nan'''ej''' || nan'''omaj''' || nan'''am'''
 
| Дательный
 
 
 
|-
 
|-
  +
| Accusative || nan'''a''' || nan'''ow''' || nan'''ow'''
 
  +
|-
| Винительный
 
  +
| Instrumental || nan'''om''' || nan'''omaj''' || nan'''ami'''
 
 
|-
 
|-
  +
| Locative || nan'''je''' || nan'''omaj''' || nan'''ach'''
 
  +
|-
| Инструментальные
 
  +
| Vocative || nan'''o'''! || nan'''aj'''! || nan'''ojo'''!
 
 
|-
 
|-
 
| Местный
 
 
|-
 
 
| Звательный
 
 
|-
 
 
 
|}
 
|}
   
  +
;Masculine inanimate (''hrěch'' "sin")
|| nan
 
   
  +
The differences from the masculine animate paradigm are indicated in blue.
|| nan'''a''' || nan'''ow''' || nan'''ow'''
 
 
|| nan'''ej''' || nan'''omaj''' || nan'''am'''
 
 
|| nan'''a''' || nan'''ow''' || nan'''ow'''
 
 
|| nan'''om''' || nan'''omaj''' || nan'''ami'''
 
 
|| nan'''je''' || nan'''omaj''' || nan'''ach'''
 
 
|| nan'''o'''! || nan'''aj'''! || nan'''ojo'''!
 
 
; неживой мужского рода (''hrěch'' " грех ")
 
 
Отличия от живого мужского рода парадигмы указаны синим цветом.
 
   
 
{|class=wikitable
 
{|class=wikitable
  +
! !! Singular !! Dual !! Plural
 
!! единственное число
 
 
!
 
 
 
|-
 
|-
  +
| Nominative || hrěch || hrěch'''aj''' || <span style="background-color:#cceeff">hrěch'''i'''</span>
 
| Именительный
 
|| hrěch
 
color:#cceeff">hrěch'''i'''</span>
 
 
 
|-
 
|-
  +
| Genitive || hrěch'''a''' || hrěch'''ow''' || hrěch'''ow'''
 
| Родительный
 
 
 
|-
 
|-
  +
| Dative || hrěch'''ej''' || hrěch'''omaj''' || hrěch'''am'''
 
| Дательный
 
 
 
|-
 
|-
  +
| Accusative || <span style="background-color:#cceeff">hrěch</span> || <span style="background-color:#cceeff">hrěch'''aj'''</span> || <span style="background-color:#cceeff">hrěch'''i'''</span>
 
  +
|-
| Винительный
 
  +
| Instrumental || hrěch'''om''' || hrěch'''omaj''' || hrěch'''ami'''
|| <span style="background-color:#cceeff">hrěch</span>
 
||
 
<span style="background-color:#cceeff">hrěch'''aj'''</span> || <span style="background-
 
color:#cceeff">hrěch'''i'''</span>
 
 
 
|-
 
|-
  +
| Locative || <span style="background-color:#cceeff">hrěch'''u'''</span> || hrěch'''omaj''' || hrěch'''ach'''
 
  +
|-
| Инструментальные
 
  +
| Vocative || hrěch'''o'''! || hrěch'''aj'''! || <span style="background-color:#cceeff">hrěch'''i'''</span>!
 
 
|-
 
|-
 
| Местный
 
hrěch'''ach'''
 
 
|-
 
 
| Звательный
 
|| hrěch'''o'''! || hrěch'''aj'''! || <span style="background-
 
color:#cceeff">hrěch'''i'''</span>!
 
 
|-
 
 
 
|}
 
|}
   
  +
;Feminine (''wróna'' "crow")
|| hrěch'''a''' || hrěch'''ow''' || hrěch'''ow'''
 
   
  +
The parts in common with the masculine paradigms are highlighted in green.
|| hrěch'''ej''' || hrěch'''omaj''' || hrěch'''am'''
 
 
|| hrěch'''om''' || hrěch'''omaj''' || hrěch'''ami'''
 
 
|| <span style="background-color:#cceeff">hrěch'''u'''</span> || hrěch'''omaj''' ||
 
 
; женский (''wróna'' "ворона")
 
 
Общие части с парадигмами мужского рода выделены зеленым цветом.
 
   
 
{|class=wikitable
 
{|class=wikitable
  +
! !! Singular !! Dual !! Plural
 
!
 
 
!! единственное число
 
 
 
|-
 
|-
  +
| Nominative || wrón'''a''' || wrón'''je''' || wrón'''y'''
 
| Именительный
 
 
 
|-
 
|-
  +
| Genitive || wrón'''u''' || <span style="background-color:#ccffcc">wrón'''ow'''</span> || <span style="background-color:#ccffcc">wrón'''ow'''</span>
 
| Родительный
 
|| wrón'''u''' || <span style="background-color:#ccffcc">wrón'''ow'''</span> ||
 
<span style="background-color:#ccffcc">wrón'''ow'''</span>
 
 
 
|-
 
|-
  +
| Dative || wrón'''je''' || <span style="background-color:#ccffcc">wrón'''omaj'''</span> || <span style="background-color:#ccffcc">wrón'''am'''</span>
 
| Дательный
 
|| wrón'''je''' || <span style="background-color:#ccffcc">wrón'''omaj'''</span> ||
 
<span style="background-color:#ccffcc">wrón'''am'''</span>
 
 
 
|-
 
|-
  +
| Accusative || wrón'''u''' || wrón'''je''' || wrón'''y'''
 
  +
|-
| Винительный
 
  +
| Instrumental || wrón'''u''' || <span style="background-color:#ccffcc">wrón'''omaj'''</span> || <span style="background-color:#ccffcc">wrón'''ami'''</span>
 
 
|-
 
|-
  +
| Locative || wrón'''je''' || <span style="background-color:#ccffcc">wrón'''omaj'''</span> || <span style="background-color:#ccffcc">wrón'''ach'''</span>
 
  +
|-
| Инструментальные || wrón'''u''' || <span style="background-color:#ccffcc">wrón'''omaj'''</span>
 
  +
| Vocative || wrón'''a'''! || wrón'''je'''! || wrón'''u'''!
|| <span style="background-color:#ccffcc">wrón'''ami'''</span>
 
 
 
|-
 
|-
 
| Местный
 
|| wrón'''je''' || <span style="background-color:#ccffcc">wrón'''omaj'''</span> ||
 
<span style="background-color:#ccffcc">wrón'''ach'''</span>
 
 
|-
 
 
| Звательный
 
 
|-
 
 
 
|}
 
|}
   
  +
;Neuter (''trašidło'' "monster")
|| wrón'''a''' || wrón'''je''' || wrón'''y'''
 
   
  +
Forms in common with both the masculine and feminine paradigms are highlighted in red.
|| wrón'''u''' || wrón'''je''' || wrón'''y'''
 
 
|| wrón'''a'''! || wrón'''je'''! || wrón'''u'''!
 
 
; средний род (''trašidło'' " чудовище ")
 
 
Формы общего мужского и женского рода парадигм, выделены красным цветом.
 
   
 
{|class=wikitable
 
{|class=wikitable
  +
! !! Singular !! Dual !! Plural
 
!
 
 
!! единственное число
 
 
 
|-
 
|-
  +
| Nominative || trašidł'''o''' || trašidł'''e''' || trašidł'''a'''
 
| Именительный
 
 
 
|-
 
|-
  +
| Genitive || trašidł'''a''' || <span style="background-color:#ffcccc">trašidł'''ow'''</span> || <span style="background-color:#ffcccc">trašidł'''ow'''</span>
 
| Родительный
 
|| trašidł'''a''' || <span style="background-color:#ffcccc">trašidł'''ow'''</span> ||
 
<span style="background-color:#ffcccc">trašidł'''ow'''</span>
 
 
 
|-
 
|-
  +
| Dative || trašidł'''u''' || <span style="background-color:#ffcccc">trašidł'''omaj'''</span> || <span style="background-color:#ffcccc">trašidł'''am'''</span>
 
| Дательный
 
|| trašidł'''u''' || <span style="background-color:#ffcccc">trašidł'''omaj'''</span> ||
 
<span style="background-color:#ffcccc">trašidł'''am'''</span>
 
 
 
|-
 
|-
  +
| Accusative || trašidł'''o''' || trašidł'''e''' || trašidł'''a'''
 
  +
|-
| Винительный
 
  +
| Instrumental || trašidł'''om''' || <span style="background-color:#ffcccc">trašidł'''omaj'''</span> || <span style="background-color:#ffcccc">trašidł'''ami'''</span>
 
 
|-
 
|-
  +
| Locative || trašidł'''e''' || <span style="background-color:#ffcccc">trašidł'''omaj'''</span> || <span style="background-color:#ffcccc">trašidł'''ach'''</span>
 
  +
|-
| Инструментальные || trašidł'''om''' || <span style="background-color:#ffcccc">trašidł'''omaj'''</
 
  +
| Vocative || trašidł'''o'''! || trašidł'''e'''! || trašidł'''a'''!
span> || <span style="background-color:#ffcccc">trašidł'''ami'''</span>
 
 
 
|-
 
|-
 
| Местный
 
|| trašidł'''e''' || <span style="background-color:#ffcccc">trašidł'''omaj'''</span> ||
 
<span style="background-color:#ffcccc">trašidł'''ach'''</span>
 
 
|-
 
 
| Звательный
 
 
|-
 
 
 
|}
 
|}
   
  +
==Lexicon==
|| trašidł'''o''' || trašidł'''e''' || trašidł'''a'''
 
   
  +
Given the description above, how do we start to write a morphological description in [[lttoolbox]]? Well, first we start with our filename, <code>hsb.dix</code>, so open up a text editor and save an empty document with that name.
|| trašidł'''o''' || trašidł'''e''' || trašidł'''a'''
 
   
  +
===The basics===
|| trašidł'''o'''! || trašidł'''e'''! || trašidł'''a'''!
 
   
  +
;The skeleton
== Лексикон ==
 
   
  +
The basic skeleton of an lttoolbox dictionary looks like the following:
Учитывая описание выше, как мы можем начать писать морфологическое описание в [[lttoolbox?
 
]] Ну, во-первых, мы начнем с нашего файла, <code> hsb.dix </ code>, так что открыть текстовый
 
редактор и сохраните пустой документ с таким именем.
 
 
=== Основы ===
 
 
; Скелет
 
 
Основной скелет словаря lttoolbox выглядит следующим образом:
 
   
 
<pre>
 
<pre>
   
 
<dictionary>
 
<dictionary>
  +
<alphabet>abc...</alphabet>
 
  +
<sdefs>
<alphabet>abc...</alphabet>
 
  +
...
 
<sdefs>
+
</sdefs>
  +
<pardefs>
 
...
+
...
  +
</pardefs>
 
  +
<section id="main" type="standard">
</sdefs>
 
  +
...
 
  +
</section>
<pardefs>
 
 
...
 
 
</pardefs>
 
 
<section id="main" type="standard">
 
 
...
 
 
</section>
 
 
 
</dictionary>
 
</dictionary>
   
 
</pre>
 
</pre>
   
  +
So type this up into the file, and this gives the outline of our the main parts of our morphology: the alphabet (used for tokenisation); the symbols (or ''tags''), which give us useful mnemonics for grammatical features; the {{tag|pardefs}} section, which gives our inflectional paradigms; and finally the main section of the file, which contains our lexical items.
Так впишите это в файл, и это даcт набросок нашей основной части нашей морфологии: алфавит;
 
символы, которые дают нам полезные мнемоники для грамматических особенностей; {{tag|
 
pardefs}} раздел, который дает наши флективные парадигмы и, наконец, основной раздел файла,
 
который содержит наши лексические элементы.
 
   
  +
;Symbol (tag) definitions
; Символa (tag) определения
 
   
  +
The first thing we'll start with is the list of symbols which are going to encode our grammatical features (part-of-speech, gender, number, case). The page [[list of symbols]] gives some common tags in Apertium. Generally we try and keep features which are named the same thing among languages tagged the same; thus, for example, the tag for "nominative" will be {{tag|nom}}, regardless of if we are talking about Romanian, Serbo-Croatian, Icelandic or Albanian. Symbols are defined in the {{tag|sdefs}} section with {{tag|sdef}} elements.
первым делом мы начнем с спискoм символов, которые будут кодировать наши грамматические
 
особенности (речь, пол, число, падеж).Страница [[list of symbols]] дает некоторые общие тaги
 
в Apertium. Вообще мы стараемся сохранить черты, которые названы одинаково среди языков
 
одинаковой меткой и, таким образом, к примеру, тaг "именительный" будет {{tag|nom}},
 
независимо от того, если мы говорим о румынском, сербско-хорватском, исландском или
 
албанцев. Символы определены в {{tag|sdefs}} разделe {{tag|Sdef}} элементов.
 
   
 
<pre>
 
<pre>
   
 
<sdefs>
 
<sdefs>
  +
<sdef n="n" c="Noun"/>
   
<sdef n="n"
+
<sdef n="ma" c="Masculine (animate)"/>
  +
<sdef n="mi" c="Masculine (inanimate)"/>
 
  +
<sdef n="nt" c="Neuter"/>
c="Noun"/>
 
  +
<sdef n="f" c="Feminine"/>
 
<sdef n="ma" c="Masculine (animate)"/>
 
 
<sdef n="mi" c="Masculine (inanimate)"/>
 
 
<sdef n="nt" c="Neuter"/>
 
 
<sdef n="f"
 
 
c="Feminine"/>
 
 
<sdef n="sg" c="Singular"/>
 
 
<sdef n="du" c="Dual"/>
 
 
<sdef n="pl" c="Plural"/>
 
 
<sdef n="nom" c=" Nominative "/>
 
 
<sdef n="gen" c=" Genitive "/>
 
 
<sdef n="dat" c=" Dative "/>
 
 
<sdef n="acc" c=" Accusative "/>
 
 
<sdef n="ins" c=" Instrumental "/>
 
 
<sdef n="loc" c=" Locative "/>
 
   
<sdef n="voc" c=" Vocative "/>
+
<sdef n="sg" c="Singular"/>
  +
<sdef n="du" c="Dual"/>
  +
<sdef n="pl" c="Plural"/>
   
  +
<sdef n="nom" c="Nominative"/>
  +
<sdef n="gen" c="Genitive"/>
  +
<sdef n="dat" c="Dative"/>
  +
<sdef n="acc" c="Accusative"/>
  +
<sdef n="ins" c="Instrumental"/>
  +
<sdef n="loc" c="Locative"/>
  +
<sdef n="voc" c="Vocative"/>
 
</sdefs>
 
</sdefs>
   
 
</pre>
 
</pre>
   
  +
The <code>c</code> after each symbol definition stands for comment and is optional but quite convenient if you have a lot of tags and want a quick reference to what they mean.
<code> c </ code> после каждого символа определения означает комментарий ( это не
 
обязательно, но весьма удобно, если у вас есть много тaгов и нужнa быстрая ссылкa на то, что они
 
означают)
 
   
  +
;Our first paradigm
; Наша первая парадигма
 
   
  +
After we've defined our symbols, then the next thing to do is to write our first paradigm. We'll start with the paradigm for ''nan'' "father". There is a convention in Apertium that each major paradigm identifier is made up of at least the name of an exemplar word and its part of speech. In this case we will also add the gender.
После того как мы определили наши символы, то следующее, что нужно сделать, это написать
 
нашу первую парадигму. Мы начнем с парадигмой''nan""отец". Существует конвенции в Apertium,
 
что идентификатор каждой основной парадигмы состоит из по крайней мере имя образцом слова
 
и части речи. В этом случае мы также добавим пола.
 
   
  +
A paradigm is made up of a series of entries. Each entry has a ''pair'' ({{tag|p}}), which in turn has a ''left'' side ({{tag|l}}) and a ''right'' side ({{tag|r}}). Normally, the [[surface form]] is found on the left and the [[lexical form]] on the right.
Парадигмы состоит из серии записей. Каждая запись имеет '' пару '' ({{tag|p}}), у которой
 
есть ''левая'' сторона ({{tag|l}}) и ''правая'' сторона ({{tag|r}}). Как правило [[surface form]]
 
находится на левой стороне и [[lexical form]] справа.
 
   
  +
We can use the symbols we defined earlier with {{tag|sdef}} tags by calling them with the {{tag|s}} element.
Мы можем использовать символы, которые мы определили ранее с {{tag|Sdef}} тaги, называя их с
 
{{tag|S}} элементoм.
 
   
 
<pre>
 
<pre>
 
 
<pardefs>
 
<pardefs>
  +
<pardef n="nan__n_ma">
  +
<e><p><l></l><r><s n="n"/><s n="ma"/><s n="sg"/><s n="nom"/></r></p></e>
  +
<e><p><l>a</l><r><s n="n"/><s n="ma"/><s n="sg"/><s n="gen"/></r></p></e>
  +
<e><p><l>ej</l><r><s n="n"/><s n="ma"/><s n="sg"/><s n="dat"/></r></p></e>
  +
<e><p><l>a</l><r><s n="n"/><s n="ma"/><s n="sg"/><s n="acc"/></r></p></e>
  +
<e><p><l>om</l><r><s n="n"/><s n="ma"/><s n="sg"/><s n="ins"/></r></p></e>
  +
<e><p><l>je</l><r><s n="n"/><s n="ma"/><s n="sg"/><s n="loc"/></r></p></e>
  +
<e><p><l>o</l><r><s n="n"/><s n="ma"/><s n="sg"/><s n="voc"/></r></p></e>
   
  +
<e><p><l>aj</l><r><s n="n"/><s n="ma"/><s n="du"/><s n="nom"/></r></p></e>
<pardef n="nan__n_ma">
 
  +
<e><p><l>ow</l><r><s n="n"/><s n="ma"/><s n="du"/><s n="gen"/></r></p></e>
 
<e><p><l></l><r><s n="n"/><s n="ma"/><s n="sg"/><s n="nom"/></r></p></e>
+
<e><p><l>omaj</l><r><s n="n"/><s n="ma"/><s n="du"/><s n="dat"/></r></p></e>
  +
<e><p><l>ow</l><r><s n="n"/><s n="ma"/><s n="du"/><s n="acc"/></r></p></e>
 
<e><p><l>a</l><r><s n="n"/><s n="ma"/><s n="sg"/><s n="gen"/></r></p></e>
+
<e><p><l>omaj</l><r><s n="n"/><s n="ma"/><s n="du"/><s n="ins"/></r></p></e>
  +
<e><p><l>omaj</l><r><s n="n"/><s n="ma"/><s n="du"/><s n="loc"/></r></p></e>
 
<e><p><l>ej</l><r><s n="n"/><s n="ma"/><s n="sg"/><s n="dat"/></r></p></e>
+
<e><p><l>aj</l><r><s n="n"/><s n="ma"/><s n="du"/><s n="voc"/></r></p></e>
 
<e><p><l>a</l><r><s n="n"/><s n="ma"/><s n="sg"/><s n="acc"/></r></p></e>
 
 
<e><p><l>om</l><r><s n="n"/><s n="ma"/><s n="sg"/><s n="ins"/></r></p></e>
 
 
<e><p><l>je</l><r><s n="n"/><s n="ma"/><s n="sg"/><s n="loc"/></r></p></e>
 
 
<e><p><l>o</l><r><s n="n"/><s n="ma"/><s n="sg"/><s n="voc"/></r></p></e>
 
 
<e><p><l>aj</l><r><s n="n"/><s n="ma"/><s n="du"/><s n="nom"/></r></p></e>
 
 
<e><p><l>ow</l><r><s n="n"/><s n="ma"/><s n="du"/><s n="gen"/></r></p></e>
 
 
<e><p><l>omaj</l><r><s n="n"/><s n="ma"/><s n="du"/><s n="dat"/></r></p></e>
 
 
<e><p><l>ow</l><r><s n="n"/><s n="ma"/><s n="du"/><s n="acc"/></r></p></e>
 
 
<e><p><l>omaj</l><r><s n="n"/><s n="ma"/><s n="du"/><s n="ins"/></r></p></e>
 
 
<e><p><l>omaj</l><r><s n="n"/><s n="ma"/><s n="du"/><s n="loc"/></r></p></e>
 
 
<e><p><l>aj</l><r><s n="n"/><s n="ma"/><s n="du"/><s n="voc"/></r></p></e>
 
 
<e><p><l>ojo</l><r><s n="n"/><s n="ma"/><s n="pl"/><s n="nom"/></r></p></e>
 
 
<e><p><l>ow</l><r><s n="n"/><s n="ma"/><s n="pl"/><s n="gen"/></r></p></e>
 
 
<e><p><l>am</l><r><s n="n"/><s n="ma"/><s n="pl"/><s n="dat"/></r></p></e>
 
 
<e><p><l>ow</l><r><s n="n"/><s n="ma"/><s n="pl"/><s n="acc"/></r></p></e>
 
 
<e><p><l>ami</l><r><s n="n"/><s n="ma"/><s n="pl"/><s n="ins"/></r></p></e>
 
 
<e><p><l>ach</l><r><s n="n"/><s n="ma"/><s n="pl"/><s n="loc"/></r></p></e>
 
 
<e><p><l>ojo</l><r><s n="n"/><s n="ma"/><s n="pl"/><s n="voc"/></r></p></e>
 
 
</pardef>
 
   
  +
<e><p><l>ojo</l><r><s n="n"/><s n="ma"/><s n="pl"/><s n="nom"/></r></p></e>
  +
<e><p><l>ow</l><r><s n="n"/><s n="ma"/><s n="pl"/><s n="gen"/></r></p></e>
  +
<e><p><l>am</l><r><s n="n"/><s n="ma"/><s n="pl"/><s n="dat"/></r></p></e>
  +
<e><p><l>ow</l><r><s n="n"/><s n="ma"/><s n="pl"/><s n="acc"/></r></p></e>
  +
<e><p><l>ami</l><r><s n="n"/><s n="ma"/><s n="pl"/><s n="ins"/></r></p></e>
  +
<e><p><l>ach</l><r><s n="n"/><s n="ma"/><s n="pl"/><s n="loc"/></r></p></e>
  +
<e><p><l>ojo</l><r><s n="n"/><s n="ma"/><s n="pl"/><s n="voc"/></r></p></e>
  +
</pardef>
 
</pardefs>
 
</pardefs>
 
 
</pre>
 
</pre>
   
  +
;Using the paradigm
; Использование Парадигмы
 
   
  +
Now that we've defined a paradigm, we can add a word that uses it. The obvious choice is "nan", being as that is the name of the paradigm.
Теперь, когда мы определили парадигму, мы можем добавить слово, которое использует его.
 
Очевидным выбором является "nan", являясь, как имя парадигмы.
 
   
 
<pre>
 
<pre>
   
<section id="main" type="standard">
+
<section id="main" type="standard">
  +
<e lm="nan"><i>nan</i><par n="nan__n_ma"/></e>
 
  +
</section>
<e lm="nan"><i>nan</i><par n="nan__n_ma"/></e>
 
 
</section>
 
   
 
</pre>
 
</pre>
   
  +
The {{tag|e}} element is the same as in the paradigm, but in the case of lexical entries (as opposed to morphological entries), it commonly contains the attribute <code>lm</code> "lemma". The {{tag|i}} tag stands for "invariant" and means that the left side is the same as the right side.
{{tag|e}} элемент такой же, как в парадигме, но в случае лексических записей (в отличие от
 
морфологических элементов), он обычно содержит атрибут <code> lm </code> "lemma".{{тaг|я}}
 
тaг означает «инвариант» и означает, что левая сторона такая же, как правaя стороны.
 
   
  +
So by this point we should have a whole dictionary with a single word in it. Save the file.
Так к этому моменту мы должны иметь целый словарь с одного слова в нем. Сохраните файл.
 
   
=== Компиляция ===
+
===Compiling===
   
  +
Once you've saved the file, you can go to the command line and try to validate it. Presuming that the file is called <code>hsb.dix</code>, then the following will check it against the definition:
После того как вы сохранили файл, вы можете пойти к командной строке и попытаться проверить
 
его. Предполагая, что файл называется <code> hsb.dix </code>, то следующий будет проверять его
 
от определениях:
 
   
 
<pre>
 
<pre>
  +
$ apertium-validate-dictionary hsb.dix
 
$ apertium-validate-dictionary hsb.dix
 
 
 
</pre>
 
</pre>
   
  +
If the dictionary is valid, you should get no output.
Если словарь еще в силе, вы не должны получить вывода.
 
   
  +
This is a major benefit over related software (e.g. [[HFST]]). If you leave out a symbol definition, then you will get an angry message from the validation script, such as the following:
Это главное преимущество над относящимися к программного обеспечения (например, [[HFST]
 
]). Если вы не введете определение символа, то вы получите сообщение от проверки скрипта,
 
например, следующие:
 
   
 
<pre>
 
<pre>
  +
$ apertium-validate-dictionary hsb.dix
 
$ apertium-validate-dictionary hsb.dix
 
 
 
hsb.dix:25: element s: validity error : IDREF attribute n references an unknown ID "nom"
 
hsb.dix:25: element s: validity error : IDREF attribute n references an unknown ID "nom"
 
 
hsb.dix:33: element s: validity error : IDREF attribute n references an unknown ID "nom"
 
hsb.dix:33: element s: validity error : IDREF attribute n references an unknown ID "nom"
 
 
hsb.dix:41: element s: validity error : IDREF attribute n references an unknown ID "nom"
 
hsb.dix:41: element s: validity error : IDREF attribute n references an unknown ID "nom"
 
 
Document hsb.dix does not validate against /home/fran/local/share/apertium/dix.dtd
 
Document hsb.dix does not validate against /home/fran/local/share/apertium/dix.dtd
 
 
</pre>
 
</pre>
   
  +
In this case, it's best to go back and check that all your symbols are defined.
В этом случае лучше вернуться и проверить, что все ваши символы определены.
 
   
  +
Assuming that our dictionary is valid, we can move to the next step and compile it.
Если предположить, что наш словарь действующий, мы можем перейти к следующему шагу и
 
скомпилировать его.
 
   
 
<pre>
 
<pre>
 
 
$ lt-comp lr hsb.dix hsb-mor.bin
 
$ lt-comp lr hsb.dix hsb-mor.bin
 
 
main@standard 29 45
 
main@standard 29 45
   
 
$ lt-comp rl hsb.dix hsb-gen.bin
 
$ lt-comp rl hsb.dix hsb-gen.bin
 
 
main@standard 29 45
 
main@standard 29 45
 
 
</pre>
 
</pre>
   
  +
The <code>lr</code> and <code>rl</code> in the compilation command stand for "left to right" and "right to left", respectively. Presuming that we have our surface form on the left and our lexical form on the right, compiling <code>lr</code> will make a morphological ''analyser'', and compiling <code>rl</code> will make a ''generator''.
<code> lr </code> и <code> rl </code> на стенде команд компиляции для "слева направо" и "справа
 
налево", соответственно. Предполагая, что у нас есть форма поверхности слева и лексическая
 
формa праве, компиляция <code> lr </ code> сделает морфологический анализатор и компиляция
 
<code> rl </ code> сделает ''генератор''.
 
 
=== Пользование ===
 
   
  +
===Usage===
 
{{see-also|lttoolbox}}
 
{{see-also|lttoolbox}}
  +
We can then test them both as follows:
 
Затем мы можем проверить их обоих следующим образом:
 
   
 
<pre>
 
<pre>
  +
$ echo "nanow" | lt-proc hsb-mor.bin
  +
^nanow/nan<n><ma><du><gen>/nan<n><ma><du><acc>/nan<n><ma><pl><gen>/nan<n><ma><pl><acc>$
   
$ echo "nanow" | lt-proc hsb-mor.bin
+
$ echo "^nan<n><ma><pl><gen>$" | lt-proc -g hsb-gen.bin
 
^nanow/nan<n><ma><du><gen>/nan<n><ma><du><acc>/nan<n><ma><pl><gen>/
 
nan<n><ma><pl><acc>$
 
 
$ echo "^nan<n><ma><pl><gen>$" | lt-proc -g hsb-gen.bin
 
 
 
nanow
 
nanow
 
 
</pre>
 
</pre>
   
Чтобы получить полный список словаря, команда <code>lt-expand</code> может быть
+
To get a full listing of the dictionary, the command <code>lt-expand</code> can be used:
использована:
 
   
 
<pre>
 
<pre>
  +
$ lt-expand hsb.dix
 
$ lt-expand hsb.dix
 
 
 
nan:nan<n><ma><sg><nom>
 
nan:nan<n><ma><sg><nom>
 
 
nana:nan<n><ma><sg><gen>
 
nana:nan<n><ma><sg><gen>
 
 
nanej:nan<n><ma><sg><dat>
 
nanej:nan<n><ma><sg><dat>
 
 
nana:nan<n><ma><sg><acc>
 
nana:nan<n><ma><sg><acc>
 
 
nanom:nan<n><ma><sg><ins>
 
nanom:nan<n><ma><sg><ins>
 
 
nanje:nan<n><ma><sg><loc>
 
nanje:nan<n><ma><sg><loc>
 
 
nano:nan<n><ma><sg><voc>
 
nano:nan<n><ma><sg><voc>
 
 
nanaj:nan<n><ma><du><nom>
 
nanaj:nan<n><ma><du><nom>
 
 
nanow:nan<n><ma><du><gen>
 
nanow:nan<n><ma><du><gen>
 
 
...
 
...
 
 
</pre>
 
</pre>
   
  +
We've got everything in place for building the dictionary. Now on to our next word.
У нас все готово для создания словаря. Теперь переходим к нашему следующему слову.
 
   
  +
==Organising paradigms==
== Организация парадигмы ==
 
   
  +
The obvious thing to do when adding the word ''hrěch'' "sin" would be to duplicate the <code>nan__n_ma</code> paradigm but change the gender and the surface forms, which are different. Then we would end up with a new paradigm, something like:
Что нужно сделать при добавлении слова''''hrěch "грех" это дублировать <code> nan__n_ma</
 
code> парадигму, но изменить пол и поверхности формы, которые отличаются. Тогда мы в итоге
 
будем с новой парадигмой, что-то вроде:
 
   
 
<pre>
 
<pre>
  +
<pardef n="hrěch__n_mi">
  +
<e><p><l></l><r><s n="n"/><s n="mi"/><s n="sg"/><s n="nom"/></r></p></e>
  +
<e><p><l>a</l><r><s n="n"/><s n="mi"/><s n="sg"/><s n="gen"/></r></p></e>
  +
<e><p><l>ej</l><r><s n="n"/><s n="mi"/><s n="sg"/><s n="dat"/></r></p></e>
  +
<e><p><l></l><r><s n="n"/><s n="mi"/><s n="sg"/><s n="acc"/></r></p></e>
  +
<e><p><l>om</l><r><s n="n"/><s n="mi"/><s n="sg"/><s n="ins"/></r></p></e>
  +
<e><p><l>u</l><r><s n="n"/><s n="mi"/><s n="sg"/><s n="loc"/></r></p></e>
  +
<e><p><l>o</l><r><s n="n"/><s n="mi"/><s n="sg"/><s n="voc"/></r></p></e>
   
  +
<e><p><l>aj</l><r><s n="n"/><s n="mi"/><s n="du"/><s n="nom"/></r></p></e>
<pardef n="hrěch__n_mi">
 
  +
<e><p><l>ow</l><r><s n="n"/><s n="mi"/><s n="du"/><s n="gen"/></r></p></e>
 
<e><p><l></l><r><s n="n"/><s n="mi"/><s n="sg"/><s n="nom"/></r></p></e>
+
<e><p><l>omaj</l><r><s n="n"/><s n="mi"/><s n="du"/><s n="dat"/></r></p></e>
  +
<e><p><l>oj</l><r><s n="n"/><s n="mi"/><s n="du"/><s n="acc"/></r></p></e>
 
<e><p><l>a</l><r><s n="n"/><s n="mi"/><s n="sg"/><s n="gen"/></r></p></e>
+
<e><p><l>omaj</l><r><s n="n"/><s n="mi"/><s n="du"/><s n="ins"/></r></p></e>
  +
<e><p><l>omaj</l><r><s n="n"/><s n="mi"/><s n="du"/><s n="loc"/></r></p></e>
 
<e><p><l>ej</l><r><s n="n"/><s n="mi"/><s n="sg"/><s n="dat"/></r></p></e>
+
<e><p><l>aj</l><r><s n="n"/><s n="mi"/><s n="du"/><s n="voc"/></r></p></e>
 
<e><p><l></l><r><s n="n"/><s n="mi"/><s n="sg"/><s n="acc"/></r></p></e>
 
 
<e><p><l>om</l><r><s n="n"/><s n="mi"/><s n="sg"/><s n="ins"/></r></p></e>
 
 
<e><p><l>u</l><r><s n="n"/><s n="mi"/><s n="sg"/><s n="loc"/></r></p></e>
 
 
<e><p><l>o</l><r><s n="n"/><s n="mi"/><s n="sg"/><s n="voc"/></r></p></e>
 
 
<e><p><l>aj</l><r><s n="n"/><s n="mi"/><s n="du"/><s n="nom"/></r></p></e>
 
 
<e><p><l>ow</l><r><s n="n"/><s n="mi"/><s n="du"/><s n="gen"/></r></p></e>
 
 
<e><p><l>omaj</l><r><s n="n"/><s n="mi"/><s n="du"/><s n="dat"/></r></p></e>
 
 
<e><p><l>oj</l><r><s n="n"/><s n="mi"/><s n="du"/><s n="acc"/></r></p></e>
 
 
<e><p><l>omaj</l><r><s n="n"/><s n="mi"/><s n="du"/><s n="ins"/></r></p></e>
 
 
<e><p><l>omaj</l><r><s n="n"/><s n="mi"/><s n="du"/><s n="loc"/></r></p></e>
 
 
<e><p><l>aj</l><r><s n="n"/><s n="mi"/><s n="du"/><s n="voc"/></r></p></e>
 
 
<e><p><l>i</l><r><s n="n"/><s n="mi"/><s n="pl"/><s n="nom"/></r></p></e>
 
 
<e><p><l>ow</l><r><s n="n"/><s n="mi"/><s n="pl"/><s n="gen"/></r></p></e>
 
 
<e><p><l>am</l><r><s n="n"/><s n="mi"/><s n="pl"/><s n="dat"/></r></p></e>
 
 
<e><p><l>i</l><r><s n="n"/><s n="mi"/><s n="pl"/><s n="acc"/></r></p></e>
 
 
<e><p><l>ami</l><r><s n="n"/><s n="mi"/><s n="pl"/><s n="ins"/></r></p></e>
 
 
<e><p><l>ach</l><r><s n="n"/><s n="mi"/><s n="pl"/><s n="loc"/></r></p></e>
 
 
<e><p><l>i</l><r><s n="n"/><s n="mi"/><s n="pl"/><s n="voc"/></r></p></e>
 
 
</pardef>
 
   
  +
<e><p><l>i</l><r><s n="n"/><s n="mi"/><s n="pl"/><s n="nom"/></r></p></e>
  +
<e><p><l>ow</l><r><s n="n"/><s n="mi"/><s n="pl"/><s n="gen"/></r></p></e>
  +
<e><p><l>am</l><r><s n="n"/><s n="mi"/><s n="pl"/><s n="dat"/></r></p></e>
  +
<e><p><l>i</l><r><s n="n"/><s n="mi"/><s n="pl"/><s n="acc"/></r></p></e>
  +
<e><p><l>ami</l><r><s n="n"/><s n="mi"/><s n="pl"/><s n="ins"/></r></p></e>
  +
<e><p><l>ach</l><r><s n="n"/><s n="mi"/><s n="pl"/><s n="loc"/></r></p></e>
  +
<e><p><l>i</l><r><s n="n"/><s n="mi"/><s n="pl"/><s n="voc"/></r></p></e>
  +
</pardef>
 
</pre>
 
</pre>
   
  +
We add an entry in the main section:
Мы добавляем запись в основном разделе:
 
   
 
<pre>
 
<pre>
  +
<e lm="hrěch"><i>hrěch</i><par n="hrěch__n_mi"/></e>
 
<e lm="hrěch"><i>hrěch</i><par n="hrěch__n_mi"/></e>
 
 
 
</pre>
 
</pre>
   
  +
All is fine, and it's a good place to start, but if we look at the tables above, the paradigm for ''nan'' and the paradigm for ''hrěch'' share many suffixes. We can call paradigms from other paradigms, so why should we duplicate them?
Все отлично, и это хорошее место для начала, но если мы посмотрим на таблицы выше,
 
парадигма''nan'' и парадигма''hrěch''имеют много суффиксов. Мы можем назвать парадигмы от
 
других парадигм, так почему мы должны дублировать их?
 
   
  +
As an alternative, the first thing we do is to split out the common suffixes into a separate paradigm. Let's call it <code>common__m</code> (for common masculine suffixes).
В качестве альтернативы, первое, что мы делаем, для разделения из общих суффиксах в
 
отдельную парадигму. Давайте назовем это <code>common__m< code> (для общего мужского
 
суффиксa).
 
   
 
<pre>
 
<pre>
  +
<pardef n="common__m">
  +
<e><p><l></l><r><s n="sg"/><s n="nom"/></r></p></e>
  +
<e><p><l>a</l><r><s n="sg"/><s n="gen"/></r></p></e>
  +
<e><p><l>ej</l><r><s n="sg"/><s n="dat"/></r></p></e>
  +
<e><p><l>om</l><r><s n="sg"/><s n="ins"/></r></p></e>
  +
<e><p><l>o</l><r><s n="sg"/><s n="voc"/></r></p></e>
   
  +
<e><p><l>aj</l><r><s n="du"/><s n="nom"/></r></p></e>
<pardef n="common__m">
 
  +
<e><p><l>ow</l><r><s n="du"/><s n="gen"/></r></p></e>
 
<e><p><l></l><r><s n="sg"/><s n="nom"/></r></p></e>
+
<e><p><l>omaj</l><r><s n="du"/><s n="dat"/></r></p></e>
  +
<e><p><l>omaj</l><r><s n="du"/><s n="ins"/></r></p></e>
 
<e><p><l>a</l><r><s n="sg"/><s n="gen"/></r></p></e>
+
<e><p><l>omaj</l><r><s n="du"/><s n="loc"/></r></p></e>
 
<e><p><l>ej</l><r><s n="sg"/><s n="dat"/></r></p></e>
 
 
<e><p><l>om</l><r><s n="sg"/><s n="ins"/></r></p></e>
 
 
<e><p><l>o</l><r><s n="sg"/><s n="voc"/></r></p></e>
 
 
<e><p><l>aj</l><r><s n="du"/><s n="nom"/></r></p></e>
 
 
<e><p><l>ow</l><r><s n="du"/><s n="gen"/></r></p></e>
 
 
<e><p><l>omaj</l><r><s n="du"/><s n="dat"/></r></p></e>
 
 
<e><p><l>omaj</l><r><s n="du"/><s n="ins"/></r></p></e>
 
 
<e><p><l>omaj</l><r><s n="du"/><s n="loc"/></r></p></e>
 
 
<e><p><l>aj</l><r><s n="du"/><s n="voc"/></r></p></e>
 
 
<e><p><l>ow</l><r><s n="pl"/><s n="gen"/></r></p></e>
 
 
<e><p><l>am</l><r><s n="pl"/><s n="dat"/></r></p></e>
 
 
<e><p><l>ami</l><r><s n="pl"/><s n="ins"/></r></p></e>
 
 
<e><p><l>ach</l><r><s n="pl"/><s n="loc"/></r></p></e>
 
 
</pardef>
 
   
  +
<e><p><l>aj</l><r><s n="du"/><s n="voc"/></r></p></e>
  +
<e><p><l>ow</l><r><s n="pl"/><s n="gen"/></r></p></e>
  +
<e><p><l>am</l><r><s n="pl"/><s n="dat"/></r></p></e>
  +
<e><p><l>ami</l><r><s n="pl"/><s n="ins"/></r></p></e>
  +
<e><p><l>ach</l><r><s n="pl"/><s n="loc"/></r></p></e>
  +
</pardef>
 
</pre>
 
</pre>
   
  +
(Note: We don't include the part of speech or gender, as that is different depending on the lemma.)
(Примечание: Мы не включаем части речи или пола, так как это отличается в зависимости от
 
lemma.)
 
   
  +
Now with this "common" paradigm available, we can simplify both the <code>nan__n_ma</code> and <code>hrěch__n_mi</code> paradigms, thusly:
Теперь с этой "общей" доступной парадигмой, мы можем упростить <code>nan__n_ma</code> и
 
<code>hrěch__n_mi</code> парадигмы, таким образом:
 
   
 
<pre>
 
<pre>
  +
<pardef n="nan__n_ma">
  +
<e><p><l></l><r><s n="n"/><s n="ma"/></r></p><par n="common__m"/></e>
  +
<e><p><l>a</l><r><s n="n"/><s n="ma"/><s n="sg"/><s n="acc"/></r></p></e>
  +
<e><p><l>je</l><r><s n="n"/><s n="ma"/><s n="sg"/><s n="loc"/></r></p></e>
   
  +
<e><p><l>ow</l><r><s n="n"/><s n="ma"/><s n="du"/><s n="acc"/></r></p></e>
<pardef n="nan__n_ma">
 
   
<e><p><l></l><r><s n="n"/><s n="ma"/></r></p><par n="common__m"/></e>
+
<e><p><l>ojo</l><r><s n="n"/><s n="ma"/><s n="pl"/><s n="nom"/></r></p></e>
  +
<e><p><l>ow</l><r><s n="n"/><s n="ma"/><s n="pl"/><s n="acc"/></r></p></e>
  +
<e><p><l>ojo</l><r><s n="n"/><s n="ma"/><s n="pl"/><s n="voc"/></r></p></e>
  +
</pardef>
   
  +
<pardef n="hrěch__n_mi">
<e><p><l>a</l><r><s n="n"/><s n="ma"/><s n="sg"/><s n="acc"/></r></p></e>
 
  +
<e><p><l></l><r><s n="n"/><s n="mi"/></r></p><par n="common__m"/></e>
  +
<e><p><l></l><r><s n="n"/><s n="mi"/><s n="sg"/><s n="acc"/></r></p></e>
  +
<e><p><l>u</l><r><s n="n"/><s n="mi"/><s n="sg"/><s n="loc"/></r></p></e>
   
<e><p><l>je</l><r><s n="n"/><s n="ma"/><s n="sg"/><s n="loc"/></r></p></e>
+
<e><p><l>oj</l><r><s n="n"/><s n="mi"/><s n="du"/><s n="acc"/></r></p></e>
 
<e><p><l>ow</l><r><s n="n"/><s n="ma"/><s n="du"/><s n="acc"/></r></p></e>
 
 
<e><p><l>ojo</l><r><s n="n"/><s n="ma"/><s n="pl"/><s n="nom"/></r></p></e>
 
 
<e><p><l>ow</l><r><s n="n"/><s n="ma"/><s n="pl"/><s n="acc"/></r></p></e>
 
 
<e><p><l>ojo</l><r><s n="n"/><s n="ma"/><s n="pl"/><s n="voc"/></r></p></e>
 
 
</pardef>
 
 
<pardef n="hrěch__n_mi">
 
 
<e><p><l></l><r><s n="n"/><s n="mi"/></r></p><par n="common__m"/></e>
 
 
<e><p><l></l><r><s n="n"/><s n="mi"/><s n="sg"/><s n="acc"/></r></p></e>
 
 
<e><p><l>u</l><r><s n="n"/><s n="mi"/><s n="sg"/><s n="loc"/></r></p></e>
 
 
<e><p><l>oj</l><r><s n="n"/><s n="mi"/><s n="du"/><s n="acc"/></r></p></e>
 
 
<e><p><l>i</l><r><s n="n"/><s n="mi"/><s n="pl"/><s n="nom"/></r></p></e>
 
 
<e><p><l>i</l><r><s n="n"/><s n="mi"/><s n="pl"/><s n="acc"/></r></p></e>
 
 
<e><p><l>i</l><r><s n="n"/><s n="mi"/><s n="pl"/><s n="voc"/></r></p></e>
 
 
</pardef>
 
   
  +
<e><p><l>i</l><r><s n="n"/><s n="mi"/><s n="pl"/><s n="nom"/></r></p></e>
  +
<e><p><l>i</l><r><s n="n"/><s n="mi"/><s n="pl"/><s n="acc"/></r></p></e>
  +
<e><p><l>i</l><r><s n="n"/><s n="mi"/><s n="pl"/><s n="voc"/></r></p></e>
  +
</pardef>
 
</pre>
 
</pre>
   
  +
Factoring out common suffixes makes paradigms more maintainable but also more complicated to understand. The features of the language, the depth of the description and the intuitions of the person writing the dictionary will dictate to what extent parts can be factored out in this way.
выработая общие суффикса парадигмы делает их более легким в обслуживании, но и более
 
сложным для понимания.Особенности языка, Глубина описание и интуиции человека, пишущего
 
словарь будет определять, в какой мере части могут быть выработанами на этом пути.
 
   
  +
Now try and add the other two words to the dictionary, along with their inflectional paradigms. A solution can be found on the [[Talk:Starting a new language with lttoolbox|talk page]].
Теперь попробуйте и добавьте другие два слова в словарь, а также их флективные парадигмы.
 
Решение можно найти на [[Talk:Starting a new language with lttoolbox|talk page]].
 
   
  +
You can also try adding the alternative forms (for example ''hrěchu'' as a possible genitive singular of ''hrěch'').
Вы также можете попробовать добавить альтернативные формы (например,''hrěchu''качестве
 
возможного родительного падежа единственного числа''hrěch'').
 
 
== Примечания ==
 
   
  +
==Notes==
 
<references/>
 
<references/>
   
  +
==Further reading==
== Дополнительная литература ==
 
   
== См. также==
+
==See also==
   
 
* [[Monodix basics]]
 
* [[Monodix basics]]
 
 
* [[Starting a new language with HFST]]
 
* [[Starting a new language with HFST]]
   

Revision as of 05:06, 11 January 2012

For information on how to install lttoolbox, see lttoolbox and minimal installation from SVN

This page is going to describe how to start a new language with lttoolbox. As lttoolbox is not really suited to agglutinative languages, or languages with complex and regular morphophonology (or at least no-one has written a dictionary from scratch using lttoolbox for one of these languages yet), we're going to work on one with simpler and less regular morphology. We particularly encourage people to use lttoolbox wherever possible; it has a straightforward syntax, has some very useful features for validation and is a canonical part of Apertium, not requiring any special software to be installed.

Preliminaries

A morphological transducer in lttoolbox has typically one file, a .dix file. This defines both how morphemes in the language are joined together, morphotactics, and how changes happen when these morphemes are joined together, morphographemics (or morphophonology). For example,

  • Morphotactics: wolf<n><pl> → wolf + s
  • Morphographemics: wolf + s → wolves

These two phenomena are treated in the same file.

The language

The language we will be modelling is Upper Sorbian, a Slavic language spoken in Germany. There is a limited grammar available in English here, and that is what we will be basing our analysis on. The part of speech we're going to look at for this small tutorial is nouns. Nouns in Upper Sorbian have seven cases (nominative, genitive, dative, accusative, locative, instrumental, vocative), three numbers (singular, dual, plural) and three genders (masculine, feminine, neuter). Like other Slavic languages, the category of animacy is distinguished in the masculine.[1]

Paradigms

Here we give four example paradigms; these will form the basis of our implementation.

Masculine animate (nan "father")
Singular Dual Plural
Nominative nan nanaj nanojo
Genitive nana nanow nanow
Dative nanej nanomaj nanam
Accusative nana nanow nanow
Instrumental nanom nanomaj nanami
Locative nanje nanomaj nanach
Vocative nano! nanaj! nanojo!
Masculine inanimate (hrěch "sin")

The differences from the masculine animate paradigm are indicated in blue.

Singular Dual Plural
Nominative hrěch hrěchaj hrěchi
Genitive hrěcha hrěchow hrěchow
Dative hrěchej hrěchomaj hrěcham
Accusative hrěch hrěchaj hrěchi
Instrumental hrěchom hrěchomaj hrěchami
Locative hrěchu hrěchomaj hrěchach
Vocative hrěcho! hrěchaj! hrěchi!
Feminine (wróna "crow")

The parts in common with the masculine paradigms are highlighted in green.

Singular Dual Plural
Nominative wróna wrónje wróny
Genitive wrónu wrónow wrónow
Dative wrónje wrónomaj wrónam
Accusative wrónu wrónje wróny
Instrumental wrónu wrónomaj wrónami
Locative wrónje wrónomaj wrónach
Vocative wróna! wrónje! wrónu!
Neuter (trašidło "monster")

Forms in common with both the masculine and feminine paradigms are highlighted in red.

Singular Dual Plural
Nominative trašidło trašidłe trašidła
Genitive trašidła trašidłow trašidłow
Dative trašidłu trašidłomaj trašidłam
Accusative trašidło trašidłe trašidła
Instrumental trašidłom trašidłomaj trašidłami
Locative trašidłe trašidłomaj trašidłach
Vocative trašidło! trašidłe! trašidła!

Lexicon

Given the description above, how do we start to write a morphological description in lttoolbox? Well, first we start with our filename, hsb.dix, so open up a text editor and save an empty document with that name.

The basics

The skeleton

The basic skeleton of an lttoolbox dictionary looks like the following:


<dictionary>
  <alphabet>abc...</alphabet>
  <sdefs>
    ...
  </sdefs>
  <pardefs>
    ...
  </pardefs>
  <section id="main" type="standard">
    ...
  </section>
</dictionary>

So type this up into the file, and this gives the outline of our the main parts of our morphology: the alphabet (used for tokenisation); the symbols (or tags), which give us useful mnemonics for grammatical features; the <pardefs> section, which gives our inflectional paradigms; and finally the main section of the file, which contains our lexical items.

Symbol (tag) definitions

The first thing we'll start with is the list of symbols which are going to encode our grammatical features (part-of-speech, gender, number, case). The page list of symbols gives some common tags in Apertium. Generally we try and keep features which are named the same thing among languages tagged the same; thus, for example, the tag for "nominative" will be <nom>, regardless of if we are talking about Romanian, Serbo-Croatian, Icelandic or Albanian. Symbols are defined in the <sdefs> section with <sdef> elements.


<sdefs>
  <sdef n="n"     c="Noun"/>

  <sdef n="ma"    c="Masculine (animate)"/>
  <sdef n="mi"    c="Masculine (inanimate)"/>
  <sdef n="nt"    c="Neuter"/>
  <sdef n="f"     c="Feminine"/>

  <sdef n="sg"    c="Singular"/>
  <sdef n="du"    c="Dual"/>
  <sdef n="pl"    c="Plural"/>

  <sdef n="nom"   c="Nominative"/>
  <sdef n="gen"   c="Genitive"/>
  <sdef n="dat"   c="Dative"/>
  <sdef n="acc"   c="Accusative"/>
  <sdef n="ins"   c="Instrumental"/>
  <sdef n="loc"   c="Locative"/>
  <sdef n="voc"   c="Vocative"/>
</sdefs>

The c after each symbol definition stands for comment and is optional but quite convenient if you have a lot of tags and want a quick reference to what they mean.

Our first paradigm

After we've defined our symbols, then the next thing to do is to write our first paradigm. We'll start with the paradigm for nan "father". There is a convention in Apertium that each major paradigm identifier is made up of at least the name of an exemplar word and its part of speech. In this case we will also add the gender.

A paradigm is made up of a series of entries. Each entry has a pair (<p>), which in turn has a left side (<l>) and a right side (<r>). Normally, the surface form is found on the left and the lexical form on the right.

We can use the symbols we defined earlier with <sdef> tags by calling them with the <s> element.

<pardefs>
  <pardef n="nan__n_ma">
    <e><p><l></l><r><s n="n"/><s n="ma"/><s n="sg"/><s n="nom"/></r></p></e>
    <e><p><l>a</l><r><s n="n"/><s n="ma"/><s n="sg"/><s n="gen"/></r></p></e>
    <e><p><l>ej</l><r><s n="n"/><s n="ma"/><s n="sg"/><s n="dat"/></r></p></e>
    <e><p><l>a</l><r><s n="n"/><s n="ma"/><s n="sg"/><s n="acc"/></r></p></e>
    <e><p><l>om</l><r><s n="n"/><s n="ma"/><s n="sg"/><s n="ins"/></r></p></e>
    <e><p><l>je</l><r><s n="n"/><s n="ma"/><s n="sg"/><s n="loc"/></r></p></e>
    <e><p><l>o</l><r><s n="n"/><s n="ma"/><s n="sg"/><s n="voc"/></r></p></e>

    <e><p><l>aj</l><r><s n="n"/><s n="ma"/><s n="du"/><s n="nom"/></r></p></e>
    <e><p><l>ow</l><r><s n="n"/><s n="ma"/><s n="du"/><s n="gen"/></r></p></e>
    <e><p><l>omaj</l><r><s n="n"/><s n="ma"/><s n="du"/><s n="dat"/></r></p></e>
    <e><p><l>ow</l><r><s n="n"/><s n="ma"/><s n="du"/><s n="acc"/></r></p></e>
    <e><p><l>omaj</l><r><s n="n"/><s n="ma"/><s n="du"/><s n="ins"/></r></p></e>
    <e><p><l>omaj</l><r><s n="n"/><s n="ma"/><s n="du"/><s n="loc"/></r></p></e>
    <e><p><l>aj</l><r><s n="n"/><s n="ma"/><s n="du"/><s n="voc"/></r></p></e>

    <e><p><l>ojo</l><r><s n="n"/><s n="ma"/><s n="pl"/><s n="nom"/></r></p></e>
    <e><p><l>ow</l><r><s n="n"/><s n="ma"/><s n="pl"/><s n="gen"/></r></p></e>
    <e><p><l>am</l><r><s n="n"/><s n="ma"/><s n="pl"/><s n="dat"/></r></p></e>
    <e><p><l>ow</l><r><s n="n"/><s n="ma"/><s n="pl"/><s n="acc"/></r></p></e>
    <e><p><l>ami</l><r><s n="n"/><s n="ma"/><s n="pl"/><s n="ins"/></r></p></e>
    <e><p><l>ach</l><r><s n="n"/><s n="ma"/><s n="pl"/><s n="loc"/></r></p></e>
    <e><p><l>ojo</l><r><s n="n"/><s n="ma"/><s n="pl"/><s n="voc"/></r></p></e>
  </pardef>
</pardefs>
Using the paradigm

Now that we've defined a paradigm, we can add a word that uses it. The obvious choice is "nan", being as that is the name of the paradigm.


  <section id="main" type="standard">
    <e lm="nan"><i>nan</i><par n="nan__n_ma"/></e>    
  </section>

The <e> element is the same as in the paradigm, but in the case of lexical entries (as opposed to morphological entries), it commonly contains the attribute lm "lemma". The <i> tag stands for "invariant" and means that the left side is the same as the right side.

So by this point we should have a whole dictionary with a single word in it. Save the file.

Compiling

Once you've saved the file, you can go to the command line and try to validate it. Presuming that the file is called hsb.dix, then the following will check it against the definition:

$ apertium-validate-dictionary hsb.dix 

If the dictionary is valid, you should get no output.

This is a major benefit over related software (e.g. HFST). If you leave out a symbol definition, then you will get an angry message from the validation script, such as the following:

$ apertium-validate-dictionary hsb.dix 
hsb.dix:25: element s: validity error : IDREF attribute n references an unknown ID "nom"
hsb.dix:33: element s: validity error : IDREF attribute n references an unknown ID "nom"
hsb.dix:41: element s: validity error : IDREF attribute n references an unknown ID "nom"
Document hsb.dix does not validate against /home/fran/local/share/apertium/dix.dtd

In this case, it's best to go back and check that all your symbols are defined.

Assuming that our dictionary is valid, we can move to the next step and compile it.

$ lt-comp lr hsb.dix hsb-mor.bin
main@standard 29 45

$ lt-comp rl hsb.dix hsb-gen.bin
main@standard 29 45

The lr and rl in the compilation command stand for "left to right" and "right to left", respectively. Presuming that we have our surface form on the left and our lexical form on the right, compiling lr will make a morphological analyser, and compiling rl will make a generator.

Usage

See also: lttoolbox

We can then test them both as follows:

$ echo "nanow" | lt-proc hsb-mor.bin 
^nanow/nan<n><ma><du><gen>/nan<n><ma><du><acc>/nan<n><ma><pl><gen>/nan<n><ma><pl><acc>$

$ echo "^nan<n><ma><pl><gen>$" | lt-proc -g hsb-gen.bin 
nanow

To get a full listing of the dictionary, the command lt-expand can be used:

$ lt-expand hsb.dix 
nan:nan<n><ma><sg><nom>
nana:nan<n><ma><sg><gen>
nanej:nan<n><ma><sg><dat>
nana:nan<n><ma><sg><acc>
nanom:nan<n><ma><sg><ins>
nanje:nan<n><ma><sg><loc>
nano:nan<n><ma><sg><voc>
nanaj:nan<n><ma><du><nom>
nanow:nan<n><ma><du><gen>
...

We've got everything in place for building the dictionary. Now on to our next word.

Organising paradigms

The obvious thing to do when adding the word hrěch "sin" would be to duplicate the nan__n_ma paradigm but change the gender and the surface forms, which are different. Then we would end up with a new paradigm, something like:

  <pardef n="hrěch__n_mi">
    <e><p><l></l><r><s n="n"/><s n="mi"/><s n="sg"/><s n="nom"/></r></p></e>
    <e><p><l>a</l><r><s n="n"/><s n="mi"/><s n="sg"/><s n="gen"/></r></p></e>
    <e><p><l>ej</l><r><s n="n"/><s n="mi"/><s n="sg"/><s n="dat"/></r></p></e>
    <e><p><l></l><r><s n="n"/><s n="mi"/><s n="sg"/><s n="acc"/></r></p></e>
    <e><p><l>om</l><r><s n="n"/><s n="mi"/><s n="sg"/><s n="ins"/></r></p></e>
    <e><p><l>u</l><r><s n="n"/><s n="mi"/><s n="sg"/><s n="loc"/></r></p></e>
    <e><p><l>o</l><r><s n="n"/><s n="mi"/><s n="sg"/><s n="voc"/></r></p></e>

    <e><p><l>aj</l><r><s n="n"/><s n="mi"/><s n="du"/><s n="nom"/></r></p></e>
    <e><p><l>ow</l><r><s n="n"/><s n="mi"/><s n="du"/><s n="gen"/></r></p></e>
    <e><p><l>omaj</l><r><s n="n"/><s n="mi"/><s n="du"/><s n="dat"/></r></p></e>
    <e><p><l>oj</l><r><s n="n"/><s n="mi"/><s n="du"/><s n="acc"/></r></p></e>
    <e><p><l>omaj</l><r><s n="n"/><s n="mi"/><s n="du"/><s n="ins"/></r></p></e>
    <e><p><l>omaj</l><r><s n="n"/><s n="mi"/><s n="du"/><s n="loc"/></r></p></e>
    <e><p><l>aj</l><r><s n="n"/><s n="mi"/><s n="du"/><s n="voc"/></r></p></e>

    <e><p><l>i</l><r><s n="n"/><s n="mi"/><s n="pl"/><s n="nom"/></r></p></e>
    <e><p><l>ow</l><r><s n="n"/><s n="mi"/><s n="pl"/><s n="gen"/></r></p></e>
    <e><p><l>am</l><r><s n="n"/><s n="mi"/><s n="pl"/><s n="dat"/></r></p></e>
    <e><p><l>i</l><r><s n="n"/><s n="mi"/><s n="pl"/><s n="acc"/></r></p></e>
    <e><p><l>ami</l><r><s n="n"/><s n="mi"/><s n="pl"/><s n="ins"/></r></p></e>
    <e><p><l>ach</l><r><s n="n"/><s n="mi"/><s n="pl"/><s n="loc"/></r></p></e>
    <e><p><l>i</l><r><s n="n"/><s n="mi"/><s n="pl"/><s n="voc"/></r></p></e>
  </pardef>

We add an entry in the main section:

    <e lm="hrěch"><i>hrěch</i><par n="hrěch__n_mi"/></e>    

All is fine, and it's a good place to start, but if we look at the tables above, the paradigm for nan and the paradigm for hrěch share many suffixes. We can call paradigms from other paradigms, so why should we duplicate them?

As an alternative, the first thing we do is to split out the common suffixes into a separate paradigm. Let's call it common__m (for common masculine suffixes).

  <pardef n="common__m">
    <e><p><l></l><r><s n="sg"/><s n="nom"/></r></p></e>
    <e><p><l>a</l><r><s n="sg"/><s n="gen"/></r></p></e>
    <e><p><l>ej</l><r><s n="sg"/><s n="dat"/></r></p></e>
    <e><p><l>om</l><r><s n="sg"/><s n="ins"/></r></p></e>
    <e><p><l>o</l><r><s n="sg"/><s n="voc"/></r></p></e>

    <e><p><l>aj</l><r><s n="du"/><s n="nom"/></r></p></e>
    <e><p><l>ow</l><r><s n="du"/><s n="gen"/></r></p></e>
    <e><p><l>omaj</l><r><s n="du"/><s n="dat"/></r></p></e>
    <e><p><l>omaj</l><r><s n="du"/><s n="ins"/></r></p></e>
    <e><p><l>omaj</l><r><s n="du"/><s n="loc"/></r></p></e>

    <e><p><l>aj</l><r><s n="du"/><s n="voc"/></r></p></e>
    <e><p><l>ow</l><r><s n="pl"/><s n="gen"/></r></p></e>
    <e><p><l>am</l><r><s n="pl"/><s n="dat"/></r></p></e>
    <e><p><l>ami</l><r><s n="pl"/><s n="ins"/></r></p></e>
    <e><p><l>ach</l><r><s n="pl"/><s n="loc"/></r></p></e>
  </pardef>

(Note: We don't include the part of speech or gender, as that is different depending on the lemma.)

Now with this "common" paradigm available, we can simplify both the nan__n_ma and hrěch__n_mi paradigms, thusly:

  <pardef n="nan__n_ma">
    <e><p><l></l><r><s n="n"/><s n="ma"/></r></p><par n="common__m"/></e>
    <e><p><l>a</l><r><s n="n"/><s n="ma"/><s n="sg"/><s n="acc"/></r></p></e>
    <e><p><l>je</l><r><s n="n"/><s n="ma"/><s n="sg"/><s n="loc"/></r></p></e>

    <e><p><l>ow</l><r><s n="n"/><s n="ma"/><s n="du"/><s n="acc"/></r></p></e>

    <e><p><l>ojo</l><r><s n="n"/><s n="ma"/><s n="pl"/><s n="nom"/></r></p></e>
    <e><p><l>ow</l><r><s n="n"/><s n="ma"/><s n="pl"/><s n="acc"/></r></p></e>
    <e><p><l>ojo</l><r><s n="n"/><s n="ma"/><s n="pl"/><s n="voc"/></r></p></e>
  </pardef>

  <pardef n="hrěch__n_mi">
    <e><p><l></l><r><s n="n"/><s n="mi"/></r></p><par n="common__m"/></e>
    <e><p><l></l><r><s n="n"/><s n="mi"/><s n="sg"/><s n="acc"/></r></p></e>
    <e><p><l>u</l><r><s n="n"/><s n="mi"/><s n="sg"/><s n="loc"/></r></p></e>

    <e><p><l>oj</l><r><s n="n"/><s n="mi"/><s n="du"/><s n="acc"/></r></p></e>

    <e><p><l>i</l><r><s n="n"/><s n="mi"/><s n="pl"/><s n="nom"/></r></p></e>
    <e><p><l>i</l><r><s n="n"/><s n="mi"/><s n="pl"/><s n="acc"/></r></p></e>
    <e><p><l>i</l><r><s n="n"/><s n="mi"/><s n="pl"/><s n="voc"/></r></p></e>
  </pardef>

Factoring out common suffixes makes paradigms more maintainable but also more complicated to understand. The features of the language, the depth of the description and the intuitions of the person writing the dictionary will dictate to what extent parts can be factored out in this way.

Now try and add the other two words to the dictionary, along with their inflectional paradigms. A solution can be found on the talk page.

You can also try adding the alternative forms (for example hrěchu as a possible genitive singular of hrěch).

Notes

  1. This description is simplistic; the reality is more complicated, but it will do for a tutorial.

Further reading

See also