Skip to content

Instantly share code, notes, and snippets.

@Deamon5550
Created November 26, 2013 07:50
Show Gist options
  • Save Deamon5550/7654758 to your computer and use it in GitHub Desktop.
Save Deamon5550/7654758 to your computer and use it in GitHub Desktop.
NameTester
package com.thevoxelbox.names;
import java.util.Random;
public class NameTester
{
public NameGen gen;
Random rand = new Random();
public void getProb() {
gen = new NameGen();
for(String s: EnglishInput) {
gen.addProb(s);
}
gen.calculateRates();
for(int i = 0; i < 100;) {
System.out.println(gen.getWord(rand.nextInt(7 + 1)));
try {
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
public static void main(String[] args) {
NameTester t = new NameTester();
t.getProb();
}
String[] EnglishInput = new String[] {
"In October I published a post about an Algorithm to generate random names",
"If you came here looking for a way to generate random names I suggest",
"you go read that post skim over the source code and then later come back here for the much better version",
"The program worked in two parts a script to generate probability tables and a",
"class called RandomNameGenerator The script was quickly thrown together I wanted to",
"save time since this was a small part of a larger project",
"When it came time months later to add more features and correct some bugs",
"I quickly regretted my decision to quickly throw together a script to",
"generate the probability tables The whole thing was hard to understand",
"and extend The version I was working with was more involved than what I had",
"originally posted and using a simple script wasn’t cutting it any more I had",
"fallen into the proverbial working fast but taking much more time in the end trap",
"So I started the whole thing over using test-first BDD OO principles and applying",
"care to my work In not much more time than it took me to write the first version",
"I had a working second version with the features I wanted and I got rid of the bugs",
"that were bugging pun intended me",
"I put the whole thing on GitHub so you can go there for the source code and to get a working copy",
"I have included some sample data to use to generate names It’s under the media",
"directory and it uses names from Greek mythology all taken from Wikipedia",
"There is a small program called fix samplerb that will try to convert",
"a sample file to the desired format The sample is expected to be in following format zebra"
};
String[] ElvishInput = new String[]{ //íîôÚúû
"A",
"Ai",
"El síla erin lu e-govaned vín",
"Gi suilon",
"Le suilon",
"Mae g'ovannen",
"Na vedui",
"No veren",
"Novaer",
"Galu",
"Savo 'lass a lalaith",
"Boe i 'waen",
"Guren níniatha n'i lû n'i a-govenitham",
"Losto vae",
"Posto vae",
"Oltho vae",
"N'i lû tôl",
"Abarad",
"Nae",
"Alae",
"No dirweg",
"Drego",
"Ego",
"Noro",
"Daro",
"Elo",
"Echuio",
"Gwaem",
"Tolo na naur",
"Aphado nin",
"Tolo govano ven",
"Gi nathlam hí",
"Le nathlam hí",
"Edraith enni",
"Udulen an edraith angin",
"Udulen an edraith anlen",
"Leithio nin",
"Boe de nestad",
"Goheno nin",
"No",
"Ú",
"An ngell nîn",
"Gi melin",
"Le melin",
"Gellon ned i gelir i chent gîn ned i lelig",
"Pedig edhellen",
"Ú-bedin edhellen",
"Pedin edhellen",
"Peditham hi sui vellyn",
"Im",
"Av-'osto",
"Ni 'lassui",
"Le fael",
"Guren glassui",
"Agoreg vae",
"Hiril vuin",
"Hîr",
"Henig",
"Ionneg",
"Iellig",
"Ada",
"Nana",
"Avon",
"Nin gwerianneg",
"Sevig thû úan",
"Dôl gîn lost",
"Amarth faeg",
"Rhaich",
"Pe-channas",
"Mi van me",
"Gwestog",
"Gwestol",
"I dass carnen",
"Boe",
"Prestad",
"Man cerig",
"Man ceril",
"Man agoreg",
"Na van",
"tôg",
"pen",
"Avo garo am man theled",
"Uhunc ylf ernedui",
"Ni ú-edhel",
"Ú-iston",
"Iston i nîf gîn",
"Iston i nîf lîn",
"Pedin i phith in aníron, a nin ú-cheniathog"
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment