🔡
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. More Techniques

Formatters

Syllabore provides a NameFormatter class for modelling names that have multiple parts and need more than one generator to create them.

Consider the following formatter that creates names in the format firstname lastname:

var firstnames = new NameGenerator()
    .Any(x => x
        .First("srl")
        .Middle("ae"))
    .SetSize(2);

var lastnames = new NameGenerator()
    .Any(x => x
        .First("mn")
        .Middle("iou")
        .Last("dtr"))
    .SetSize(2);

var formatter = new NameFormatter("{first} {last}")
    .Define("first", firstnames)
    .Define("last", lastnames);

Calling formatter.Next() will create names like:

Lara Nirmot
Sesa Midnir
Rela Mudnut

PreviousMore TechniquesNextGenerator Pools

Last updated 2 months ago