kesac / Syllabore

A fantasy name generator that does not use pre-made lists of names
MIT License
39 stars 2 forks source link

A replacement for OfTrailingConsonantIsSequence function #13

Open javiaxum opened 10 months ago

javiaxum commented 10 months ago

Cheers, just getting started with Syllabore but want to express my appreciation for the authors' work. So far this solution fits my needs the best of all I could find on Github.

This might be a mix of general questions and bug reports here, so I may split them into distinct issues. I did read all the guides on the wiki. My version is 2.3.2.

A side question there:

And tiny remarks for the guides:

Thanks for your time!

kesac commented 10 months ago

Thanks for your interest in the library! Here are my responses to each bug/question:

Coda clusters in the final syllable

Coda clusters in the final syllable can be controlled using a combination of WithFinalConsonantSequences() and OfFinalConsonants() like so:

var syllables = new SyllableGenerator()
    .WithVowels("ae")
    .WithLeadingConsonants("srl")
    .WithFinalConsonantSequences("th") // "Final consonants" are trailing consonants used in the final syllable only
    .WithProbability(x => x
        .OfFinalConsonants(1.0, 1.0)); // 100% chance of a final coda, 100% chance the coda is a coda cluster

A NameGenerator using the SyllableGenerator above would produce names like Saleth or Raseth.

Using a combination of WithTrailingConsonantSequences() and OfTrailingSequences() would also work, but the coda cluster th would appear in the opening and intermediate syllables too. (eg. Sathleth, Rathseth)

My sincere apologies: I now realize the wiki is missing information about final consonants and I will ensure the wiki gets updated to include it.

Should a SyllableGenerator with no vowel graphemes provided return an empty string?

In a scenario where a SyllableGenerator has no vowels defined it should occasionally throw exceptions during syllable generation unless the consonant probability is set to 100% or empty string generation is explicitly permitted.

This would be ok to use:

var syllables = new SyllableGenerator()
    .WithLeadingConsonants("srl")
    .AllowEmptyStrings(true);

And this would be ok too:

var syllables = new SyllableGenerator()
    .WithLeadingConsonants("srl")
    .WithProbability(x => x
        .OfLeadingConsonants(1)
        .OfVowels(0));

Other side questions/comments

Guide 1.1.2 mentions that onset and coda are optional, is that from a linguistic perspective or it is intended to be a constraint for SyllableGenerator?

Great question, I need to update 1.1.2 as this is from a linguistic perspective only.

Are vowels intended to be mandatory to specify for SyllableGenerator to function?

Vowels are mandatory if the vowel probability is not zero and SyllableGenerator should throw an exception during generation (ie. when it reaches into the vowel pool and finds no graphemes to use).

Also I noticed that when I try to override...

I agree this is a bug, I will look into it. You should be able to define vowels and clusters only, and have it all appear in the output space without touching the probability table.

3.1 Section has a typo?

Thanks I will get it corrected!

At the end of the section a deprecated UsingProvider method is being used.

Thanks! I will also get this corrected!


Edits: