Sunday, April 17, 2011

Garbage In, Language Out

I once created a program that created languages.  Well, not whole languages, just the words.  There may have been many inspirations for it, but I can only remember two of them.

The first was a Dragon magazine article that I've never been able to remember the name of or find again.  The article contained a good bit of detail on creating languages, and brought to my attention the components that made a language 'soft' or 'hard,' and went on to create, if I remember correctly, to start an elven and orcish lexicon based on those principles.  Fascinating article that I haven't seen for 25 years or so.

The second was the Vargr supplement for Traveller.  The Vargr were an uplifted star-faring canine race.  In the supplement were tables to enable the referee to generate random Vargr words.  Using the system, you could create a bunch of noises that sounded somewhat like growls and barks, but was completely serviceable for naming your wolf-man characters, their starships, and worlds.  It was really neat.

I figured I could take my Commodore 64 and write a program that spat out randomized words based on sound chunks that gave all of the words a certain feel.  I was successful, and have rewritten program many times on many different platforms, whenever I remembered what I had done and felt a need for it again.  Some versions were really complex, some incredibly simple.  All fit a need.

The current version I have is in Visual Basic Script - so it will work on just about any Windows type box.  If anyone is interested, I have it available here. Simply download it and unzip the directory.  You don't have to know butkus about programming to run it, or adjust the important bits.

RatherGameyWordCreator.vbs is the script.  You can usually just double-click it to make it run.  It reads in the SoundFile.txt, which is comprised of one sound per line.  The script them randomizes the sounds into variable length words and spits them out in a file called Word.txt.

I have a couple of example sound files that you can play with, just rename them or copy the contents to Soundfile.txt and let 'er rip. Create your own collections of sounds and create your own languages.  It's fun!  Well, geeky fun, but still - fun!

For the lazy, I'm copying the content of the script here so you can peruse it.  There are lots of variables up at the top you can tweak to adjust the lengths of words, the amount generated, etc.  It's a pretty simple program, and smarty-farty programmers could probably improve it a thousand fold.

I release this script to you as open source - so open source that it ain't even BSD or GNU.  It's just yours.  Run wild. ;)

'
' RatherGameyWordCreator.vbs
' Makes Words from SoundFile.txt
' Writes them to Words.xt
'
Option Explicit
RANDOMIZE

Dim FileSystemObjectInput, InputFileName, InputFile, InputFileLine
Dim FileSystemObjectOutput, OutputFileName, OutputFile
Dim RandomSound, RandomLength, SoundMax, SoundMin, LengthMax, LengthMin, Word
Dim NumberOfWords, Count, i, j
Dim Sounds()

Count = 0
NumberOfWords = 10
SoundMin = 0
LengthMax = 6
LengthMin = 1

InputFileName = "SoundFile.txt"
OutputFileName = "Words.txt"

Set FileSystemObjectInput = CreateObject("Scripting.FileSystemObject")

If FileSystemObjectInput.FileExists(InputFileName) Then
 Set InputFile = FileSystemObjectInput.OpenTextFile(InputFileName, 1)
  Do While Not InputFile.AtEndOfStream
   InputFileLine = InputFile.ReadLine
    If Trim(InputFileLine) <> "" Then
      Redim Preserve Sounds(Count)
      Sounds(Count) = InputFileLine
      Count = Count + 1
    End If
  Loop
 InputFile.Close
Else
 WScript.Echo "The sound file was not there. Please create SoundFile.txt"
End If

Set FileSystemObjectOutput = CreateObject("Scripting.fileSystemObject")
Set OutputFile = FileSystemObjectOutput.CreateTextFile(OutputFileName, TRUE)

SoundMax=Count-1

For i = 1 To NumberOfWords
 RandomLength = (Int((LengthMax-LengthMin+1)*Rnd+LengthMin))
 For j = 1 To RandomLength
  RandomSound = Sounds(Int((SoundMax-SoundMin+1)*Rnd+SoundMin))
  If Word = "" Then
   Word = RandomSound
  Else
   Word = Word & "-" & RandomSound
  End If
 Next
 OutputFile.WriteLine(Word)
 Word=""
Next

OutputFile.Close
Set FileSystemObjectOutput = Nothing
WScript.Quit(0)

- Ark

4 comments:

  1. I am almost certain the article you are looking for is "Orcish is Logical" and "All games need names" from Dragon Magazine #75 page 54.

    There is a possibility you are also talking about the Languages section from Issue #66.

    Feel free to contact me if you'd like 'more information' if you know what I mean. My address is on my blog.
    http://hackslashmaster.blogspot.com/

    ReplyDelete
  2. Yeah, I'm guessing it's 75. I xeroxed the two language articles from it and had them in a 3 ring binder back in the day, as they say. I used the three column-chart-chart-of-syllables technique to make words for an Ent language, and a courtly language. The second article in the issue is actually an accessibly written introduction into kinds of languages-- agglutinative etc.

    This, by an odd coincidence, is the same issue James blogged about in praise of the Greenwood articles on Hell. Ahh, miss the Dragon of those days.

    ReplyDelete
  3. I just happened to look through that language article the other day... the "Orcish is Logical" rings a bell. I think that is it.

    ReplyDelete
  4. @-C - Yup, 75 - that is it. Strangely, 'More information' arrived - unsolicited - on my electronic doorstep. But I do thank you for your informative offer. :)

    @Telecanter - I loved Dragon back then. The comic book shop guy knew it too, and would set one aside until I could raise the hefty sum from my allowance. :)

    @Anon - Yup!

    - Ark

    ReplyDelete