What is it?

lex2xml is a Perl script that converts a Shoebox .lex file into XML. It reads the .lex file from STDIN and outputs the XML to STDOUT.

Note that the current version is written specifically for my conlang Asha'ille. You will have to modify the script in the following places to use it yourself:

  • replace @hierarchy with your own word-categories
  • replace <lexicon> attributes with your own values
  • replace <person> node with your own values
  • replace x-asha with your own ISO language code
  • replace Ashaille.pm with your own language-specific module, defining (and renaming) the following functions:
    • replace kateinu and kateinu_sort with your own conlang-specific romanization schemes


  1. Perl
  2. Text::Shoebox and Text::Shoebox::Lexicon modules
  3. CXS module
  4. Lexicon.pm
  5. Ashaille.pm


The current version of lex2xml can be downloaded here (last modified July 25, 2011).


Run the Perl script like so:

lex2xml < dictionary.lex > dictionary.xml

See lexicon-update.sh for how to use this script to go from Shoebox .lex file to the "pretty" dictionary and thesaurus that I use for Asha'ille.


Example dictionary.lex input:

\lx caea
\ph 'ke.A
\ps n
\ge world
\sd fe:nature
\et fv:aea
\dc 19/Nov/2002
\dt 16/Feb/2004

\lx jhurla
\ph 'Zur\lA
\ps interj
\ge hello
\xv Vedá aró jhurla vel das.
\xe Good morning, everyone.
\xt 17/Dec/2004
\ue Cannot be used to greet someone you don't know
\dc before 17/Dec/2004
\dt 17/Dec/2004

Example dictionary.xml output:

<?xml version="1.0" encoding="UTF-8" ?>

   xsi:schemaLocation="http://www.arthaey.com/conlang/lexicon lexicon.xsd"


<person role="author">
   <name>Arthaey Angosii</name>

   <gloss lang="en">world</gloss>
   <domain lang="en">nature</domain>
   <xref type="etymology">aea</xref>

   <gloss lang="en">hello</gloss>
      <text lang="x-asha">Vedá aró jhurla vel das.</text>
      <text lang="en">Good morning, everyone.</text>
   <note type="usage">Cannot be used to greet someone you don't know</note>