Starting Out
Last updated
Last updated
See the if you're looking to add Syllabore to your project for the first time.
If it's already added to your project, make sure the following directive near the top of the class file you're using generate names:
Use the class to generate names and call Next()
to get new names. The following example creates a single name and prints it to the console:
Each call to names.Next()
will return names like:
To understand how generation works, continue reading below. If you want better control of generation, jump to the fine-tuning techniques like , , , or .
Names are made up of syllables which are in turn made up of symbols. Here's how the word wonderful
can be broken down into symbols and syllables:
In Syllabore, names have three syllable positions:
The starting syllable
The ending syllable
The inner syllable, which is always positioned between the starting and ending syllables
Inside a syllable, there are symbol positions:
The first symbol
The last symbol
The middle symbol, which is always positioned in the "center" and usually a vowel
For example, here are the symbol positions in the word dog
:
Consider the following name generator.
This generator is setup with the following rules:
Use symbols s
t
r
in the first position of syllable
Use symbols a
e
o
in the middle position of a syllable
Don't use anything for the last position of a syllable
Another way to configure this NameGenerator
is to create the SymbolGenerator
for its consonants and vowels first.
In the example above, calls to names.Next()
will also generate names like:
Syllabore provides a fluent interface for configuring generators. This is optional and often cuts down on the amount of setup code.
To use the fluent interface, a class file must contain the following directive near the top of the file:
This will let you construct a name generator like so:
In this fluent example, calls to names.Next()
will once again generate names like:
A is highly configurable. This is done by customizing its underlying and .
To fine-tune generators, read on to the next section which will cover techniques like , , , and .