Generating words for your conlang
One of the most labour-intensive stages of creating a conlang (constructed language) is generating the masses of words required, and also of ensuring you have enough distinct words that use the full range of options that you designed into the language. Thankfully it’s a trivial task to do this with a computer program, and being a developer myself I’ve written a simple script that can be used to generate an “instant dictionary”.
Now obviously you’re not constrained by the output; if you see a word that doesn’t feel right for the assigned meaning, then of course you’re free to swap it for something else. Use your auto-generated dictionary as a jumping-off point to get you going, rather than a shackle for your creativity!
The technical stuff
Nice as it would be to offer you a standalone program, I’m not qualified to do that. Instead, I’ll show you how to use a popular programming language called Perl to run my code. Perl was designed to be good at handling strings of characters, so it’s the perfect language for conlanging. Don’t worry, you won’t have to write any code per se, just the file that describes your conlang.
If you’re using a Mac, you can skip the rest of this paragraph, as Perl is provided as part of the OSX operating system (ditto with Linux, but if you’re a Linux geek you probably already know about Perl!). If you’re a Windows user, you can get a free installation bundle from ActiveState; I originally learnt Perl when I was still on Windows. If you go this route, I suggest selecting the 5.14.x package, as I haven’t had the opportunity to try my code on version 5.16.x yet.
You’ll also need a program that can create and edit plain text files. In Windows, you could use Notepad or Wordpad, but I recommend the free text editor Notepad++ as it will be better at handling the files I’ve written in OSX (Windows and Unix use different non-printing characters to denote line endings). For Mac users, the built-in TextEdit program will do fine as long as you make sure to save new files as plain text, not .rtf, or you might like to try the free text editor TextWrangler.
Both Notepad++ and TextWrangler have syntax highlighting, meaning they colour-code the text according to its meaning within the format/programming language being used. This doesn’t make much difference with text files, but if you start poking around in the Perl script, it’s very helpful for distinguishing blocks of code from comments.
Please note that I can’t offer technical support on installing and using these common tools; there are masses of resources online, so I recommend you resort to Google if you have any problems.
You’ll need to run the script in a terminal window; rather than try and explain that here, I’ve linked to some handy online tutorials:
- Windows command prompt tutorial
- OSX terminal tutorial (NB. the built-in Terminal program, found in Applications/Utilities, is more than capable of running this script, so you don’t need to install iterm)
Finally you’ll need to download the zip file containing my Perl script and some sample input files.
- instant_dictionary.zip (9Kb)
Preparing your input
My dictionary script takes two input files. One is a simple list of English words that you’d like to “translate” into your conlang. I’ve provided two sample lists, based on various “universal word root” lists that I’ve encountered over the years. One is fairly short—only 200-odd words, mostly verbs, nouns and adjectives—whereas the other is over a thousand items long and covers a wider range of concepts. It’s a good idea to edit them to suit your conlang’s culture; for example I omitted words like “husband”, “wife” and “marriage” from my Vinlandic dictionary as skraylings don’t live together after mating.
The other input file you need is one that defines the sound patterns in your language; it’s the one named ‘example.conf’ in the download. This requires a bit more explanation!
The lines starting # are comments, meaning that they are ignored by the Perl script, so you can use them to remind yourself what each part of this “sound configuration” file is doing.
First we define our pattern of sounds within a word – see last week’s post on how to design a phonology for your conlang. Each capital letter in the pattern represents a list of sounds that we’ll define later in the file. The letters can be anything you want as long as they’re unique to each sound group; I generally use C and V to represent the full range of consonants and vowels respectively, and other letters to represent subsets of sounds.
Here, I’ve decided that the pattern is a consonant, a vowel, a “final” consonant, and a short vowel. Note that there has to be a space between each letter.
# Pattern of phonemes in root Name=Pattern C V F S
Next we have to define each sound group. For each one, you need a line Name=X, where X corresponds to one of the letters in your pattern, then immediately below that you list the sounds, again separated by a space.
In this very simple example, all sounds have equal frequency in the language. For a more naturalistic result you might want to increase the frequency of some sounds and make others rarer. This is simple to do; just include multiple examples of the common sounds in your list, and include rare ones only once. (This will also potentially introduce homophones into your conlang, which is a good thing if you’re aiming for naturalism.)
Another refinement you can make is to allow an element to be optional. To do this, include a hyphen as one of your possible “sounds”; the script will strip it out when it prints the dictionary. As with other sounds, you can vary the probability by altering the frequency of hyphens in your list.
Note also that the definitions don’t have to be in the same order as the elements in your pattern, and that you only need to define each group once.
# Consonants Name=C p t k b d g m n l r s z h w y - Name=F p t k b d g m n l r s z # Vowels Name=V a e i o u aa ei ii ai ao ou Name=S a e i
Create your own file; if you name it after your conlang (e.g. vinlandic.conf), that name will be used in the header of the output file. Make sure you keep all the files in the same directory as the script.
Running the script
Now comes the moment of truth!
In your terminal window, navigate to the folder that contains the downloaded files, and type:
perl instadict.pl -s example.conf -d short_wordlist.txt
Obviously you can substitute the name of your sound file and use the longer word list if you prefer. The script will run, and within moments you should have your output file. Then in your Windows File Manager (Finder in OSX), look in the conlang directory for an HTML file, then double-click on it to open in a browser window. Voilà! Instant dictionary 🙂
If you would prefer a simple text file listing the results, append the flag –txt to your command, thus:
perl instadict.pl -s example.conf -d short_wordlist.txt --txt
Either way, if you’re not happy with the results, you can run the script again. By default the script includes a timestamp in the output file name, so it creates a new file each time.
That’s really all there is to it. I hope you find this script useful; do let me know how you get on!