🔡
Syllabore
GitHub
  • Overview
  • Starting Out
  • Fine-Tuning Generators
    • Positioning
    • Clusters
    • Weights
    • Chancing
    • Transforms
    • Filtering
  • More Techniques
    • Formatters
    • Generator Pools
    • Syllable Sets
    • Generator Serialization
  • More Examples
    • Soft/Hard-Sounding Names
    • Fantasy Names
    • Spaceship Names
    • Futuristic City Names
  • Class Docs
    • FilterCondition
    • FilterConstraint
    • GeneratorPool<T>
    • INameFilter
    • INameTransformer
    • IPotentialAction
    • IRandomizable
    • ISyllableGenerator
    • Name
    • NameFilter
    • NameFormat
    • NameFormatter
    • NameFormatterGeneratorOptions
    • NameGenerator
    • NameGeneratorSerializer
    • NameGeneratorTypeInformation
    • SerializedNameGenerator
    • SyllableGenerator
    • SyllableGeneratorFluentWrapper
    • SyllablePosition
    • SyllableSet
    • Symbol
    • SymbolGenerator
    • SymbolPosition
    • Transform
    • TransformSet
    • TransformStep
    • TransformStepType
Powered by GitBook
On this page
  1. Fine-Tuning Generators

Clusters

A symbol doesn't have to be a single character. Symbols with more than one character in them are called symbol clusters or just clusters for short.

Clusters can be added using the Cluster() method. Consider the following generator:

var names = new NameGenerator()
    .Any(x => x
        .First(x => x
            .Add("str")
            .Cluster("sh", "th")) // Clusters must be separated with commas
        .Middle(x => x
            .Add("aeo")
            .Cluster("ou")));
See non-fluent version
var consonants = new SymbolGenerator("str")
    .Cluster("sh", "th"); // Add consonant clusters
    
var vowels = new SymbolGenerator("aeo")
    .Cluster("ou"); // Add vowel clusters
    
var syllables = new SyllableGenerator()
    .Add(SymbolPosition.First, consonants)
    .Add(SymbolPosition.Middle, vowels);

var names = new NameGenerator()
    .SetSyllables(SyllablePosition.Any, syllables);

In this example, the generator is given the following rules:

  • Choose from 3 symbols and 2 clusters (sh,th) for the first position of any syllable

  • Choose from 3 symbols and 1 cluster (ou) for the middle position of any syllable

  • Don't use any symbol or cluster for the last position of a syllable

Calls to names.Next() will generate names like:

Sashara
Rousa
Tethorou
PreviousPositioningNextWeights

Last updated 2 months ago