Sort a dictionary

From Apertium
Jump to navigation Jump to search

Sort task

A task for sorting dictionaries is available in the crossdics package.

"Same file" mode

./dictools sort -mon -same-file dics/morf.dix morf-xincluded.dix

XInclude mode

./dictools sort -mon -xinclude dics/morf.dix morf-xincluded.dix

Using this mode elements are grouped by category and splitted in different XML files -- in folder morf-xincluded.dix-include. Definitions and paradigms are written in different files too (sdefs.dix and pardefs.dix).

The main file is morf-xinclude.dix and it looks like this:

<?xml version="1.0" encoding="iso-8859-1"?>
<dictionary>
  <alphabet>ÀÁÂÄÇÈÉÊËÌÍÎÏÑÒÓÔÖÙÚÛÜàáâäçèéêëìíîïñòóôöùúûüABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz</alphabet>
    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="apertium-es-ca.es-xincluded.dix-includes/sdefs.dix"/>
    <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="apertium-es-ca.es-xincluded.dix-includes/pardefs.dix"/>
    <section id="main" type="standard">
      <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="apertium-es-ca.es-xincluded.dix-includes/det.dix"/>
      <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="apertium-es-ca.es-xincluded.dix-includes/predet.dix"/>
      <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="apertium-es-ca.es-xincluded.dix-includes/np.dix"/>
      <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="apertium-es-ca.es-xincluded.dix-includes/n.dix"/>
      <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="apertium-es-ca.es-xincluded.dix-includes/ij.dix"/>
      <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="apertium-es-ca.es-xincluded.dix-includes/adj.dix"/>
      ...
      <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="apertium-es-ca.es-xincluded.dix-includes/adv.dix"/>
  </section>
  <section id="final" type="inconditional">
  </section>
</dictionary>

Dictionaries with xi:include's

Using the following task will include the contents of each xi:include statement.

$ ./dictools process-xincludes apertium-xx-yy.xx.dix apertium-xx-yy.xx-expanded.dix

See also