Back again to ask more about name generation -- this time about the dictionary of syllables which I apparently need to reliably generate a name. For reference, my last question.

I've written a little bit of code which, given a file, uses the first line to determine how long the name can be (with multiple options for variability), then builds one from the syllables given in the rest of it. It works decently enough, given example syllables in an example file. For those wanting to try out a set of syllables of their own, I've made a version on Ideone.com. stdin contains the list of lengths and syllables.

That's where I'm having an issue, though. What should I use for the syllables? I've looked around, but I've been unable to find a good list of names to draw from. Maybe it's just that I'm bad at this or something, but I can't really get a good list of syllables that make names. To add to that, I have to do it by hand, and I'd much rather make a program to split a list of names into syllables, but I can't get that to work. I'll post the source for my attempt once I'm home.

In short, how can I get a good list of syllables for use in a name generator? Is there pre-existing code I can use or modify and pass it a list of names to chop into syllables, then save those to a file? If not, how would I go about writing my own?

  • \$\begingroup\$ What you're looking for are N-grams. Basically you would first get a list of names (say, from the US census). Then, you pass that through an N-gram processor to find 2 or 3 grams. Then you can generate unique names by combining the grams with a markov chain. \$\endgroup\$
    – mklingen
    Commented Jan 9, 2015 at 20:27
  • \$\begingroup\$ @mklingen Would that be the entire list giving me two or three grams, or each name? I'd assume each name, but I just want to confirm. Also, could you post an answer of that (i.e. With pseudocode) so I can accept it? \$\endgroup\$
    – anon
    Commented Jan 9, 2015 at 20:31
  • \$\begingroup\$ You'd want to find N-grams in names individually, then count the resulting N-grams to find the most common ones. This is kind of speculation on my part (haven't implemented this in practice), so I'll wait for someone who is more knowledgable than me to provide a real answer. \$\endgroup\$
    – mklingen
    Commented Jan 9, 2015 at 20:44

1 Answer 1


I suggest you base yourself on some syllable-based languages then add the missing syllables, such as "K_" single consonants and so on.

For example:

enter image description here

Add arbitrary rules for names of creature races / game region. (eg: sand area names all end in ?i and start with m? and never have any p? or ?e, at most one single-consonant in a name) to give some ""consistency"" / familiarity to the player.

Then add a function to turn those syllables into the user's writing system (eg: English letter spellings). This is the part that will have to be localized for different languages.

Also, you might need to add a localized black-list to invalidate obscene words that will randomly come up and their close-enoughs syllables, and in multiple cultures across the world. although it could be hilarious without you could end up with your game pulled off the shelves if its not 18+. Make sure to check within names for matching obscene words even when surrounded by extra syllables.

You're opening a big can of cultural problems with random name generation. For example in your previous question one name was "Gozidi" with can sound awfully close to 'big member down there' in French with a tiny bit of stretch. That's an innocent enough example that will only cause some giggling but you can imagine some more offensive things accidentally coming out and people getting quite upset.

Drama you can do without when all you want to do is create a fun game. It's something to keep in mind.

  • \$\begingroup\$ Ooh, I didn't think about it from this perspective. I'll see if I can do that. The problem is that I'll still have to manually put in the syllables -- really, this answer would have been better suited to my first question than this. Still, it's a good answer. I'll see if I can start making it. Also, in response to your concerns about a cultural can of worms, this game is being made for myself and a few friends. I might eventually publish it, but that's a big if, so I'm not too concerned about it. Same goes for localization -- for now, it'll be hardcoded to English. \$\endgroup\$
    – anon
    Commented Jan 10, 2015 at 19:16

You must log in to answer this question.