This is a Dwarf Fortress Language Creator. It is also a word generator.
I made it in Ruby, so you will need to have ruby installed to use it. I tested in on both Linux and Windows, so it should work on those. I haven't tested it on a Mac, so I don't know whether it will work on one or not. It's pretty basic ruby code though, so I can't think why it wouldn't work on one.
Version 0.9 - Contains the program and an example language file.
Change log - It's the first version
How to useUsing the program is pretty simple.
First, unzip the program. You should get wordgen.rb and example_lang.txt.
Then, open a command promt/terminal/thingy and go to the directory where you put wordgen.rb.
To create a language file, enter:
ruby wordgen.rb --dwarf \path\to\lang.txt \path\to\language_DWARF.txt NAME
If I wanted to create the Bakemono language, and had a language file called bakemono_lang.txt, I would enter:
ruby wordgen.rb --dwarf bakemono_lang.txt C:\Documents and Settings\Phi2Dao\My Documents\Games\Dwarf Fortress\df_28_181_40d15_win\raw\objects\language_DWARF.txt BAKEMONO
This would create a file in my current location called language_BAKEMONO.txt. Simple, huh.
To use wordgen.rb as a word generator, enter:
ruby wordgen.rb -g \path\to\lang.txt 10
This would print 10 words to the screen.
ruby wordgen.rb -G \path\to\lang.txt \new\file\name.txt 10
would create a new file with 10 words in it.
Adding "u" to either -g or -G makes the program generate unique words.
ruby wordgen.rb -Gu bakemono_lang.txt testfile.txt 2000
would create a file called testfile.txt which would contain 2000 unique words.
NOTE: Don't use -u unless your language file can create that many unique words. Currently, it locks up if it tries.
Language FilesThe language files that wordgen.rb requires are both simple and complicated. There is an example file included with the download, and you should be sure to look it over. Some of the help in that file might be weird, because I am really tired right now, and too lazy to fix it. If you are still confused after what I write below, just post your questions, and I will try and help you.
We will start out with a realy simple language file. It looks like this:
<weight default 1>
<startrule word>
<rule word>
<string SSS>
<rule S>
<string cv>
<symbol a>
<format v>
<symbol b>
<format c>
This file will always produce bababa. Lets see why.
First, <startrule word>. This tells the program that the rule it should start with is rule word.
Next, <string SSS>. This is below <rule word>, so it is a part of rule word. It tells the program that the word will have three "S", whatever that means.
Next, <rule S>. Aha! This is the "S" that rule word was talking about. what does rule S say?
<string cv>. This tells the program that each S will have a "c" followed by a "v".
Having figured out that neither "c" nor "v" are rules, the program will look through the formats.
The program sees that symbol b has format c, so for "c" the program puts "b". It sees that symbol a has format v, so for "v" the program puts "a". This will occur for each "S" in <string SSS>. The end result will be "bababa".
Our language file is pretty boring, so lets make some small changes. If our new language file looks like this:
<weight default 1>
<startrule word>
<rule word>
<string SSS>
<rule S>
<string cv>
<string vc>
<symbol a>
<format v>
<symbol b>
<format c 10>
<symbol c>
<format c>
What will wordgen.rb produce? The answer is, something like "baabab" or "acbaba" or "baacac" or ...
Lets see why. For one, we added a new <string> to rule word. When a rule has more than one <string> it randomly picks between them.
Another change was we added a new symbol, and gave it the same format as symbol b. When a format has more than one symbol, it randomly picks between them.
This file will produce more "b" than "c", though. This is because the number 10 in <format c 10> makes "b" more likely to occur than "c". The higher the weight, the more likely the symbol or rule.
You can set the default weight of symbols with the tag <weight default x>.
There is more in example_lang.txt, so be sure to look through it.
If you have any questions, please post them.
If you have any requests, please post them.
If you want to talk about the weather, please do so.
I'll probably provide some more language files eventually.