I would just like to be able to make a pass to check that NPRs aren't being created with silly names as they're frequently generated with real-world place names.
If you can outline the 'non-silly name' logic, I would be happy to implement it
Well, the real solution would be to create a random name generator. Of course it takes a lot of work to generate aesthetically pleasing results. Here's a quick and dirty java random name generator I threw together to generate some alien-sounding names:
import java.util.Random;
public class RandomNameGenerator
{
String plosives = "ptkbdg";
String onsets = "ptkbsfhjmnvz";
String codas = "tkbdgsmnrl";
String onset_medials = "rlwy";
String coda_medials = "rln";
String vowels = "aeiou";
int onset_chance = 80;
int onset_medial_chance = 20;
int coda_chance = 80;
int coda_medial_chance = 10;
int dipthong_chance = 10;
Random rand;
public RandomNameGenerator()
{
rand = new Random();
rand.setSeed(System.currentTimeMillis());
}
public char GetRandomLetter(String str)
{
int len = str.length();
int num = rand.nextInt(len);
return str.charAt(num);
}
public String GenerateSyllable()
{
String ret = new String();
if (rand.nextInt(100) <= onset_medial_chance)
{
ret += GetRandomLetter(plosives);
ret += GetRandomLetter(onset_medials);
}
else if (rand.nextInt(100) <= onset_chance) ret += GetRandomLetter(onsets);
ret += GetRandomLetter(vowels);
if (rand.nextInt(100) <= dipthong_chance) ret += GetRandomLetter(vowels);
if (rand.nextInt(100) <= coda_medial_chance)
{
ret += GetRandomLetter(coda_medials);
ret += GetRandomLetter(codas);
}
else if (rand.nextInt(100) <= coda_chance) ret += GetRandomLetter(codas);
return ret;
}
public String GenerateWord()
{
String ret = new String();
for (int x = rand.nextInt(2) + 2; x > 0; x-- )
{
ret += GenerateSyllable();
}
return ret;
}
}
public class Main
{
public static void main(String[] args)
{
RandomNameGenerator rng = new RandomNameGenerator();
Random rand = new Random();
rand.setSeed(System.currentTimeMillis());
String str = new String();
for (int x = 100; x > 0; x-- )
{
System.out.println(rng.GenerateWord());
}
}
}
Sample output:
proknim
faporfur
varpyis
aram
gyoknabmalm
onno
ursklusbom
kotkwos
kebturnor
haktas
pyidpud
sonkras
pletkuteag
kweethabfers
tudwahei
kubaimkunk
folotoenb
mekputblun
toleu
bwikkogklo
eban
kamugseg
kebraok
ohailhog
pamfag
vukwur
zitdwarhod
neudom
krulmozat
zafols
utnalam
sekseln
utmagbe
felfudjoab
suneg
tenzont
bugsem
mobprurgtild
ermbyub
pobonis
nurha
pugfoddlaat
grurkfilvok
umplid
unulkug
tadmorkkwol
tildkweug
hudyassis
obkaan
akanfes
ponum
torembyeb
muldnib
fihunfa
binskyebkus
blanhab
funkbut
niges
arut
erbyot
gwanrji
fileod
basdwaad
sunhinmua
nunhed
adton
krumuktward
huljud
tigbas
sannos
mimbu
dranjus
vorbaanat
kyurmad
dwasadton
kleaitdyug
aamjirs
tirpalmulg
netbek
faltukgwol
mulhut
jubog
mobzo
judyolvarm
kusan
ulkrugun
gyizurbvum
brenminhid
immet
kwerpiddlont
kobzeukzuurt
bozuub
twilgtlotam
ikpoer
pitmull
kridipiak
zukka
sajersplon
tutvim
draoglaal
A more elegant solution might be to use the real-world database names as a starting point, and then apply random changes, for example, change out one consonant for another, remove syllables, etc.