randomperson 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env ruby -wKU
2
+ # coding: utf-8
3
+
4
+ module RandomPerson
5
+
6
+ require 'Names'
7
+
8
+ class BasqueLast
9
+ include Names
10
+
11
+ #def names() NAMES; end
12
+
13
+ def initialize
14
+ @formats = {
15
+ :single => ->(n){ n.rand },
16
+ }
17
+
18
+ @formats_ratiod = [ 0..99 ]
19
+ end
20
+
21
+ attr_accessor :formats, :formats_ratiod
22
+
23
+ def execute( person, format=nil )
24
+ if @formats.length > 1
25
+ r = rand(@formats_ratiod.last.end)
26
+ i = @formats_ratiod.index_in_range( r )
27
+ f = @formats.by_index(i).last
28
+ else
29
+ f = @formats[:double_barrelled]
30
+ end
31
+
32
+ Names.execute( NAMES, f )
33
+ end
34
+
35
+
36
+ NAMES = %w{ Agirre Aguirre Alberdi Allende Alsogaray Alurralde Amézaga Arana Aráoz Araya Archuleta Arismendi Armendáriz Arriaga Arrieta Ayala Ayala Azcárraga Azcárate Azua Barrios Bengoechea Bolívar Buenechea Caínzos Camus Cano Caro Carranza Carrera Duhalde Echenique Echevarria Echeverría Elissalde Elizalde Elizondo Esparza Esquivel Etcheverry Etxeberria Eyzaguirre Garay García Garmendia Goicoechea Gorostiaga Goya Goyeneche Ibarra Landa Larraín Loyola Mendieta Mendoza Montoya Mujica Murua Ochoa Oñate Orozco Palacio Salazar Saldívar Solano Ugalde Ugarte Urbina Uribe Urquiza Urrutia Ursúa Velasco Vergara Vizcaino Vizcarra Xavier Ybarra Zabala Zaldívar Zavaleta Zúñiga Zurita }
37
+
38
+ end
39
+ end
40
+
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby -wKU
2
+
3
+ module RandomPerson
4
+
5
+ require 'Names'
6
+
7
+ class EnglishFemaleFirst
8
+ include Names
9
+
10
+ def execute( person, format=nil )
11
+ Names.execute( NAMES )
12
+ end
13
+
14
+ # def names( ) NAMES; end
15
+
16
+ NAMES = %w{ aimee aleksandra alice alicia allison alyssa amy andrea angel angela ann anna anne annie ashley barbara beatrice beth betty brenda brooke candace cara caren carol caroline carolyn carrie cassandra catherine charlotte chrissy christen christina christine christy claire claudia courtney crystal cynthia dana danielle deanne deborah deirdre denise diane dianne dorothy eileen elena elizabeth emily erica erin frances gina giulietta heather helen jane janet janice jenna jennifer jessica joanna joyce julia juliana julie justine kara karen katharine katherine kathleen kathryn katrina kelly kerry kim kimberly kristen kristina kristine laura laurel lauren laurie leah linda lisa lori marcia margaret maria marie marina marisa martha mary maya melanie melissa michelle monica nancy natalie nicole nina pamela patricia rachel rebecca renee sandra sara sharon sheri shirley sonia stefanie stephanie susan suzanne sylvia tamara tara tatiana terri theresa tiffany tracy valerie veronica vicky vivian wendy }
17
+ end
18
+ end
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env ruby -wKU
2
+
3
+ module RandomPerson
4
+
5
+ require 'Names'
6
+
7
+ class EnglishLast
8
+ include Names
9
+
10
+ #def names() NAMES; end
11
+
12
+ def initialize
13
+ @formats = {
14
+ :single => ->(n) { n.rand },
15
+ :double_barrelled_hyphenated=> ->(n) { n.rand + '-' + n.rand },
16
+ }
17
+
18
+ @formats_ratiod = [ (0..96), (97..99) ]
19
+ end
20
+
21
+ attr_accessor :formats, :formats_ratiod
22
+
23
+ def execute( person, format=nil )
24
+ r = rand(@formats_ratiod.last.end)
25
+ i = @formats_ratiod.index_in_range( r )
26
+ Names.execute( NAMES, @formats.by_index(i).last )
27
+ end
28
+
29
+
30
+ NAMES = %w{ Smith Johnson Williams Jones Brown Davis Miller Wilson Moore Taylor Anderson Thomas Jackson White Harris Martin Thompson Garcia Martinez Robinson Clark Rodriguez Lewis Lee Walker Hall Allen Young Hernandez King Wright Lopez Hill Scott Green Adams Baker Gonzalez Nelson Carter Mitchell Perez Roberts Turner Phillips Campbell Parker Evans Edwards Collins Stewart Sanchez Morris Rogers Reed Cook Morgan Bell Murphy Bailey Rivera Cooper Richardson Cox Howard Ward Torres Peterson Gray Ramirez James Watson Brooks Kelly Sanders Price Bennett Wood Barnes Ross Henderson Coleman Jenkins Perry Powell Long Patterson Hughes Flores Washington Butler Simmons Foster Gonzales Bryant Alexander Russell Griffin Diaz Hayes }
31
+
32
+ end
33
+ end
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env ruby -wKU
2
+
3
+ module RandomPerson
4
+ require 'Names'
5
+ class EnglishPrefix
6
+ include Names
7
+
8
+ TITLES = %w(Mr. Dr. Mrs. Ms. Miss )
9
+ TITLES_ratiod = [ 0..47, 48..50, 51..52, 53..81, 82..99]
10
+
11
+ def execute( person, format=nil)
12
+
13
+ if person.age < 17
14
+ return 'Miss' if person.gender == 'f'
15
+ return 'Mr.'
16
+ end
17
+
18
+ r = rand(51) #0..50
19
+ r += 49 if person.gender == 'f' #give 50% chance of being a Dr
20
+
21
+ i = TITLES_ratiod.index_in_range( r )
22
+ return TITLES[i]
23
+ end
24
+
25
+ end
26
+ end
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env ruby -wKU
2
+ # coding: utf-8
3
+
4
+ module RandomPerson
5
+
6
+ require 'Names'
7
+
8
+ class SpanishFemaleFirst
9
+ include Names
10
+
11
+ #def names() NAMES; end
12
+
13
+ def initialize
14
+ @formats = {
15
+ :single => ->(n) { n.rand },
16
+ }
17
+
18
+ @formats_ratiod = [ (0..99) ]
19
+ end
20
+
21
+ attr_accessor :formats, :formats_ratiod
22
+
23
+ def execute( person, format=nil )
24
+ if @formats.length > 1
25
+ r = rand(@formats_ratiod.last.end)
26
+ i = @formats_ratiod.index_in_range( r )
27
+ f = @formats.by_index(i).last
28
+ else
29
+ f = @formats[:single]
30
+ end
31
+ Names.execute( NAMES, f )
32
+ end
33
+
34
+
35
+ NAMES = %w{ Ababa Adela Adelaida Adelia Adelina Adriana África Alba Alejandra Alicia Alma Alondra Altagracia Amanda Amaya Amelia Amparo Ana Andrea Angélica Antonia Antonieta Araceli Ascensión Asunción Aurelia Aurora Azucena Aída Beatriz Belén Benita Berta Blanca Brunilda Bárbara Camila Caridad Carla Carlota Carmen Carolina Catalina Cecilia Celia Clara Claudia Clotilde Concepción Consolación Consuelo Cristina Cruz Daniela Dayana Delia Desamparados Diana Dionisia Dolores Dominga Dorotea Débora Elena Elisa Elvira Emilia Encarnación Enriqueta Ernestina Esperanza Estefanía Estela Ester Esther Eufemia Eugenia Eulalia Eva Fabiana Fabiola Felicidad Felipa Felisa Fernanda Filomena Flavia Flora Florencia Francisca Gabriela Gema Gloria Graciela Guadalupe Guillermina Hilda Hortensia Ilda Imelda Inmaculada Inés Irene Isabel Jacinta Joaquina Josefa Josefina Juana Julia Juliana Julieta Laura Lea Leonor Leticia Lidia Lilia Liliana Lorena Lorenza Lourdes Luciana Lucía Luisa Luna Luz Lía Magdalena Maite Manuela Marcela Marcelina Margarita Mariana Marina Marta Martina María María Jesús María José María Magdalena Matilde Mayte Mercedes Micaela Miguela Milagros Montserrat Mónica Narcisa Natalia Natividad Nieves Nilda Noelia Noemí Ofelia Olga Patricia Paula Paulette Paulina Paz Pilar Purificación Rafaela Ramona Raquel Rebeca Remedios Ricarda Rocío Rosa Rosalía Rosario Roxana Sandra Sara Selena Serafina Silvia Sofía Soledad Sonia Susana Tania Teodora Teresa Thiare Tiare Tomasa Trinidad Valentina Verónica Vicenta Victoria Virginia Yesenia }
36
+
37
+ end
38
+ end
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env ruby -wKU
2
+ # coding: utf-8
3
+
4
+ module RandomPerson
5
+
6
+ require 'Names'
7
+
8
+ class SpanishLast
9
+ include Names
10
+
11
+ #def names() NAMES; end
12
+
13
+ def initialize
14
+ @formats = {
15
+ :double_barrelled => ->(n){ n.rand + ' ' + n.rand },
16
+ :de => ->(n){ n.rand + ' de ' + n.rand },
17
+ :compound_hyphenated => ->(n){ n.rand + ' ' + n.rand + ' ' + n.rand },
18
+ :compound_y => ->(n){ n.rand + ' ' + n.rand + ' y ' + n.rand },
19
+ }
20
+
21
+ @formats_ratiod = [ 0..74, 75..90, 91..96, 97..99 ]
22
+ end
23
+
24
+ attr_accessor :formats, :formats_ratiod
25
+
26
+ def execute( person, format=nil )
27
+ if @formats.length > 1
28
+ r = rand(@formats_ratiod.last.end)
29
+ i = @formats_ratiod.index_in_range( r )
30
+ f = @formats.by_index(i).last
31
+ else
32
+ f = @formats[:double_barrelled]
33
+ end
34
+ Names.execute( NAMES, f )
35
+ end
36
+
37
+
38
+ NAMES = %w{ Abarca Acarons Acosto Acuoa Adega Agassiz Agia Aguero Aguila Aguilar Aguilera Aguirre Aicega Alaminos Alas Albanese Albano Albarracin Albenino Albo Albornos Alcantara Aldama Alday Alderate Alegria Aleixandre Alemany Alemao Alkorta Allende Almagro Almendros Almeyda Alonso Altamirano Alvarez Alvaro Alvear Alzugaray Amatrian Amavisca Amendola Amor Anaya Andrés Angeloz Angulo Antón Antuma Aragon Aranda Arbizu Archuleta Arellano Arispana Aristia Aristizabal Aristzabal Armas Armendariz Armesto Arnal Arrese Arria Arruti Arrutti Arteaga Arzu Ascencion Aspe Asprilla Avellanos Ayala Azaria Aznar Badillo Bajtera Balbi Balbo Balboa Ballestero Ballesteros Balmaceda Banderas Barón Baradez Baraona Barba Barchitta Bardem Barjuan Barreiro Barrenechea Barrichello Barrigo Barrio Basadre Batistuta Batiz Batran Bauza Bazán Bea Becerra Becerril Belaúnde Bello Beloki Belsue Beltrones Benavides Benet Benitez Benítez Berganza Bergasa Berlanga Bermejo Bermudez Bernabé Bernal Bernaldez Beto Blanco Boedo Bolano Bolea Borges Borrego Bote Braga Bravo Bricenos Brizeno Brizuela Brugera Bueno Buey Bugeja Bunuel Burillo Burrieza Busques Bustos Caballero Cabellero Cabello Cabral Cabrero Cacares Cacho Cachon Cadena Cadero Cafu Caio Calatrava Caldern Calero Calvo Camacho Camardan Camardiel Camillo Caminero Campo Campos Canal Canans Canas Canellas Canesa Canete Cano Canseco Canura Carabali Carballo Carbajal Carbonell Carbonero Cardenas Carderas Carmona Carranco Carranzo Carrasco Carreno Carrera Carretero Carriedo Carriles Carrión Carvalho Casald liga Casamayor Casas Cascos Casero Caso Castanada Castaneda Castilla Castillo Castrejana Castrilli Castro Castulo Catalan Catano Cea Ceballos Celades Centurión Cerezo Ceron Cervano Cervantes Cervera Chamot Chapado Chascarillo Chaves Chavira Checa Chedraui Chiamuhera Chiamulera Chico Chilavert Chillida Cieza Cisneros Clavet Clavijero Clemente Clopes Cobo Coceres Coelho Cois Cojuango Concepcion Contreras Corbacho Corbelan Cordero Cordobes Cordona Cordova Cornejo Coronel Corral Corrales Correa Corretja Cortez Cortina Corvalan Coya Cresaco Crespo Criado Criville Crusellas Cruz Cubrero Cuéllar Cuello Cuenca Cuervo Cuesta Cúneo-Vidal Da Gama Dabino Damián Dávila Dávilo Davino Alencar Assis Cabrea Caxias Jesus Garza Iglesia Madrid Rosa Vega Lacerda Mena Mendoza Rosas Saldanha Sancha Souza Tavira Urquiza De Vivero Debarros Deferr Delmorales Delgado Diago Diaz Diego Diez Disegni Dominguez Dorantes Duany Duce Dunga Durán Echave Echevarria Edinho Edo Elcano Elixaeberna Elizondo Enciso Enrique Enriquez Erosa Escamillo Escartin Escriba Escriva Escuda Escudero Espejo Espinosa Espinoza Estay Estete Estrada Fabrega Fajardo Falcón Falla Fanez Farfán Feijoo Fejos Felipe Feliu Feo Fernández Ferrado Ferrer Figo Figueira Filho Fiz Flores Foa Fonseca Formoselle Fraga Francia Francisquito Franco Frechilla Frois Fuente Fuentes Fuginato Funes Gaite Galdarres Galíndez Galindo Gallardo Gallego Gama Gamarra Gamboa Gamez Gangotena Garbajosa Garcia Garcilaso Garibay Garrido Garza Gasco Gaspar Gasquilan Gastelú Gats Gavaldon Gavilán Giberau Gibernau Gil Ginez Girón Gomez Gomiz Gonzaga Gonzales Gorriz Granados Grande Guadalcázar Guaman Guardiola Guerra Guerrero Guerro Guevara Guillen Guimarães Guinassi Gumy Guruceta Gutiérrez Guzmán Henarez Henchoz Heras Hernandez Herrera Hidalgo Hierro Hoero Holguin Hoyos Huerta Huertas Hurtado Ibanez Icaza Idalia Iguaran Illan Imaz Iniguez Insulza Isambero Isasi Ivarra Jara Jaramillo Jimenez Juarez Jura Jurada Juradu Keiva Kiko Lamela Lanos Lapenti Lara Laredo Larraneta Lastres Lazaro Ledesma Len Leon Leona Lerma Lianos Lima Lissón Lizarraga Lizaur Llano Llosa Lopez Lora Lorca Loredo Lorente Lorenzo Losada Lozada Lozana Lozano Lucero Luenga Luna Lurdes Madero Magallanes Magarino Maldonado Mamita Manderiaga Manjarin Manrique Mantilla Manzo Marcari Marcelo Mardomingo Margas Marín Marquez Márquez Marquina Marroquín MartÍ Nez Martel Martinez Marulanda Masoliver Masolta Massana Mattez Matutes Mauri Mayo Mayor Mayoral Mazinho Medina Meira Mejia Meléndez Melgarejo Meligeni Meligenis Mena Menchu Mendez Mendieta Mendiluce Mendiola Menem Meolans Merino Merlo Merry Mery Messia Methol Mezo Miguez Milian Minguet Minoza Miralles Miranda Molina Mondello Monentes Monreal Montalvo Montana Montaña Montanes Montano Montavez Monte Montejo Montero Monteros Montez Montolio Montoro Montoya Montt Mora Moraga Morales Moran Morayta Morcillo Morel Moreno Moretta Morgovejo Morientes Moscoso Motolinía Moya Muniz Munoz Murillo Muro Murrieta Nabarro Naca Nadal Nadol Naharro Narvaez Nascimento Navaez Navarrete Navarro Nino Noboa Nolasco Noseda Núnez Obrégon Ocacio Ocampo Ochoa Odriozola Ogarrio Olano Olazabal Oliva Olmedo Olmos Oneta Oraglio Ordialds Ordiales Ordonez Orellana Orgónez Orizaga Orozco Orrego Ortega Orteguilla Ortiz Osario Osorio Otero Párez Pacheco Padilla Paez Páez Palacios Palencia Pancorbo Pando Pánfilo Paraguez Pardo Paredes Pareds Parilla Parra Parrado Parraguez Parreira Parrera Pascual Passarella Pastrana Patino Pedralves Pedras Pedroso Pelaez Perahia Perdiguero Perez Periate Pessoa Peyrera Piedrahita Pimental Pineda Pinedo Pinelo Pinero Pinilla Pinto Pinzon Pinzón Pires Pita Pitillas Piza Pizarro Pizzaro Platas Plazas Poblano Polanco Polo Porcallo Porcel Porras Portas Portocarrero Posados Pracatan Prado Preciado Preciosa Pretel Prieto Prieto Puente Puerta Pueyo Puig Puiggros Pulido Puron Quehlas Queiro Querido Quesada Quesado Questi Quevedo Quintero Quirot Rudenas Rabal Radondo Raimondi Ramiez Ramirez Ramos Rangel Rascon Rebuelta Recio Regal Rengifo Restrepo Reto Rey Reyes Riba Ribadeneyra Riberol Rimoldi Rincon Rionda Riquelme Rivas Rivera Rivero Roa Robaina Robano Robledo Roca Rocha Rodas Rodriguez Roig Rojas Rojo Rollero Roma Romero Romo Rosas Rosauro Rovapera Rozadilla Ruano Rubiera Rubio Rubios Rubruquis Rucina Rudas Rufo Ruiberriz Ruiz Saavedra Sáenz Saer Sagredo Sahagún Sala Salarza Salas Saldamando Salgada Salinas Salto Salvatella Sámarez Samper Sanchez Sanchis Sandoval Sanin Sanroma Santa Maria Santana Santiago Santiseban Santoro Santos Santoyo Sanz Sarabia Sarmiento Sarsola Seabra Sebrian Seda Sedeno Segarra Segurola Senra-Silva Sepúlveda Sergi Serna Serpa Serra Serrano Sert Servia Siculo Sieres Sierra Siliceo Silloniz Soitino Solana Solano Soldadera Soldan Solozano Sortani Sosa Sota Sotelo Sotomayor Spano Sporleda Suarez Suárez Tallez Tabuyo Tadena Taffarel Tapia Tarrega Tavares Tejada Tello Teofilo Terezinho Terranova Terrazos Terreros Texidor Tintorero Toldeo Toledano Toledo Tomas Toriano Toribio Torrens Torres Torrillas Tortosa Tovar Troncoso Trujillo Tuero Tuscarora Ubidia Ugarte Ulloa Unzues Urrutia Urteaga Ussica Vaime Valcárcel Valderrama Valencia Valente Valenzuela Valero Vales Valignano Vallalpando Valle Vallejo Vaquero Varela Vargas Vargos Vasques Vazquez Vega Vegaso Vegros Velasco Velazquez Vélez Véliz Velloso Vendabal Vennera Vera Verdugo Verme Veron Viana Vicario Vila Villa Villalobos Villar Villaroel Villaruel Villasenor Viloca Vinciguerra Vingade Viola Vivas Vizcaino Volonte Vrais Woriega Xalmiento Xerez Ximenéz Xovi Xuárez Yanez Yegros Yocemento Yuste Zabaleta Zaga Zamarilla Zamorano Zapata Zavarjelos Zerbino Zhili Zorita Zuaza Zubero Zubizarreta Zuidema Zuluaga }
39
+
40
+ end
41
+ end
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env ruby -wKU
2
+ # coding: utf-8
3
+
4
+ module RandomPerson
5
+
6
+ require 'Names'
7
+
8
+ class SpanishMaleFirst
9
+ include Names
10
+
11
+ #def names() NAMES; end
12
+
13
+ def initialize
14
+ @formats = {
15
+ :single => ->(n) { n.rand },
16
+ }
17
+
18
+ @formats_ratiod = [ (0..99) ]
19
+ end
20
+
21
+ attr_accessor :formats, :formats_ratiod
22
+
23
+ def execute( person, format=nil )
24
+ if @formats.length > 1
25
+ r = rand(@formats_ratiod.last.end)
26
+ i = @formats_ratiod.index_in_range( r )
27
+ f = @formats.by_index(i).last
28
+ else
29
+ f = @formats[:single]
30
+ end
31
+ Names.execute( NAMES, f )
32
+ end
33
+
34
+
35
+ NAMES = %w{ Aarón Abrahán Absalón Abundio Adalberto Adolfo Adriano Adrián Adán Agapito Albano Alberto Alejandro Alfonso Alfredo Andrés Aniceto Antero Antonio Ariel Armando Arturo Aurelio Bartolomé Basilio Benito Benjamín Bernardo Blas Bonifacio Carlos Cayetano Claudio Cornelio Cristóbal César Damián Daniel David Diego Dionisio Domingo Edmundo Eduardo Egidio Eliseo Elías Emanuel Emilio Enrique Ernesto Esteban Eugenio Ezequiel Fabio Fabián Federico Felipe Fernando Francisco Franco Gabriel Germán Gershu Gilberto Gonzalo Gregorio Gustavo Hugo Humberto Héctor Ignacio Isaac Isidoro Isidro Ismael Iván Jacinto Jacobo Jaime Javier Jesús Joaquín Jorge Josué José José María Juan Juano Julio Julián Justo Leandro Leonardo León Lorenzo Lucas Luciano Luis Manuel Marcelino Marcelo Marcial Marcos Mariano Mario Martín Mateo Matías Máximo Miguel Miguel Ángel Moisés Narciso Natalio Nicolás Pablo Patricio Pedro Pío Rafael Ramón Raúl Ricardo Roberto Rodolfo Rodrigo Rogelio Rubén Salomón Salvador Samuel Sancho Santiago Saúl Sebastián Sergio Silvio Simón Tadeo Teodoro Timoteo Tito Tomás Valentín Vicente Vito Yago Ángel Óscar }
36
+
37
+ end
38
+ end
39
+
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env ruby -wKU
2
+ # coding: utf-8
3
+
4
+ module RandomPerson
5
+
6
+ require 'Names'
7
+
8
+ class ThaiFirst
9
+ include Names
10
+
11
+ #def names() NAMES; end
12
+
13
+ def initialize
14
+ @formats = {
15
+ :single => ->(n) { n.rand },
16
+ }
17
+
18
+ @formats_ratiod = [ (0..99)]
19
+ end
20
+
21
+ attr_accessor :formats, :formats_ratiod
22
+
23
+ def execute( person, format=nil )
24
+ if @formats.length > 1
25
+ r = rand(@formats_ratiod.last.end)
26
+ i = @formats_ratiod.index_in_range( r )
27
+ f = @formats.by_index(i).last
28
+ else
29
+ f = @formats[:single]
30
+ end
31
+ Names.execute( NAMES, f )
32
+ end
33
+
34
+
35
+ NAMES = %w{ กมล กาญจนา เกษม จารุวรรณ ดวงใจ ถนอม ทัศนีย์ ธงชัย ธิดา ณรงค์ นงลักษณ์ นพดล นฤมล นิตยา บัญชา ประจักษ์ ประชา ประทุม ปัญญา ปราณี ปรีชา พรชัย พรรณี ไพบูลย์ ไพโรจน์ มนตรี มานะ มานิตย์ มาลี ยุพิน รัชนี รัตนา วัฒนา วราภรณ์ วาสนา วิเชียร วินัย วิโรจน์ ศศิธร ศิริพร สมชาย สมทรง สมพร สมหมาย สมศรี สำราญ สุกัญญา สุชาดา สุชาติ สุเทพ สุนีย์ สุภาภรณ์ อนงค์ อนันต์ }
36
+
37
+ end
38
+ end
39
+
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env ruby -wKU
2
+
3
+ module RandomPerson
4
+
5
+ require 'Names'
6
+
7
+ class ThaiRomanisedFemaleFirst
8
+ include Names
9
+
10
+ #def names() NAMES; end
11
+
12
+ def initialize
13
+ @formats = {
14
+ :single => ->(n) { n.rand },
15
+ }
16
+
17
+ @formats_ratiod = [ (0..99)]
18
+ end
19
+
20
+ attr_accessor :formats, :formats_ratiod
21
+
22
+ def execute( person, format=nil )
23
+ if @formats.length > 1
24
+ r = rand(@formats_ratiod.last.end)
25
+ i = @formats_ratiod.index_in_range( r )
26
+ f = @formats.by_index(i).last
27
+ else
28
+ f = @formats[:single]
29
+ end
30
+ Names.execute( NAMES, f )
31
+ end
32
+
33
+
34
+ NAMES = %w{ Abhasra Achara Adung Anchali Apsara Ban Banjit Benjakalyani Boon-Nam Boon-Mee Busaba Butri Cantana Catchada Chaiama Chalermwan Chanachai Chandra Chanhira Chanthara Chao-Fa Charanya Chariya Charoen Charoenrasamee Charunee Chatmanee Chatrsuda Chatumas Chaveevan Chawiwan Chintana Chirawan Choi Chomechai Chomesri Chomsiri Chuachan Chuasiri Chulaborn Chumbot Churai Damni Dao Dhipyamongko Dok Dok-Rak Duan Duang-Prapha Hansa Jaidee Jintana Kaeo Kalaya Kamala Kamchana Kanchana Kanita Kannika Kanya Khae Khun Khunying Kimnai Klip Kohsoom Krijak Kultilda Kwaanfah Kwanjai Lalana Lamai Lamom Lek Lukden Ma-Dee Mae Mae-Duna Mae-Khao Mae-Noi Mae-Pia Mae-Ying-Thahan Mai Malee Mali Malivalaya Maliwan Manee Mani Manya-Phathon Maprang Mekhala Mekhalaa Mekhla Monthani Naruemon Ngam Ngor Nim Nimnuan Nittaya Noi Noklek Noom Pakpao Petchra Phak-Phimonphan Phan Phara Phi Phim Piam Pichitra Pitsamai Prahong Pranee Prang Praphat Rajini Ramphoei Ratana Rochana Rutana Saeng Sangwan Saowapa Sarai Sarakit Savitree Sawat Simla Sirikit Sirindhorn Somawadi Son-Klin Songsuda Sri-Patana Srinak Srisuriyothai Sua Suchada Sugunya Sukanda Sukonta Sumalee Sumana Sunanda Sunatda Sunetra Sunisa Supaporn Sureeporn Talap Tamarine Thaksincha Thao-Ap Thiang Tida Tookta Tppiwan Tui Tuk Tukata Tulaya Tum Tuptim Ubolratana Um Ung Wani-Ratana-Kanya Wipa Wismita Yaowalak Yen Ying Yodmani }
35
+
36
+ end
37
+ end
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env ruby -wKU
2
+
3
+ module RandomPerson
4
+
5
+ require 'Names'
6
+
7
+ class ThaiRomanisedLast
8
+ include Names
9
+
10
+ #def names() NAMES; end
11
+
12
+ def initialize
13
+ @formats = {
14
+ :single => ->(n) { n.rand },
15
+ :double_barrelled => ->(n){ n.rand + ' ' + n.rand },
16
+ }
17
+
18
+ @formats_ratiod = [ 0..49, 50..99 ]
19
+ end
20
+
21
+ attr_accessor :formats, :formats_ratiod
22
+
23
+ def execute( person, format=nil )
24
+ if @formats.length > 1
25
+ r = rand(@formats_ratiod.last.end)
26
+ i = @formats_ratiod.index_in_range( r )
27
+ f = @formats.by_index(i).last
28
+ else
29
+ f = @formats[:single]
30
+ end
31
+ Names.execute( NAMES, f )
32
+ end
33
+
34
+
35
+ NAMES = %w{ Aromdee Atitarn Bunyasarn Chaiprasit Chaisurivirat Jetatikarn Jetjirawat Juntasa Kadesadayurat Kaewburesai Kaouthai Kasamsun Kitjakarn Kongkatitum Kongpaisarn Kongsangchai Kraiputra Kunakorn Kunchai Kurusarttra Leekpai Leelapun Lertkunakorn Maleenon Maneerattana Meesang Narkbunnum Narkhirunkanok Nimitwanitch Ornlamai Paowsong Parnpradub Parnthong Pornpipatpong Prasongsanti Puntasrima Punyawong Rojjanasukchai Rojumanong Saenamuang Sakda Sangsorn Shinawatra Sirisopa Somchai Somwan Songprawati Sripituksakul Srisati Sriwarunyu Sukbunsung Suntornnitikul Suppamongkon Suttirat Tawisuwan Thumying Tuntayakul Udomprecha Vipavakit Visalyaputra Wattanapanit Wattanasin Yongjaiyut Yuvaves }
36
+
37
+ end
38
+ end
@@ -0,0 +1,37 @@
1
+ #!/usr/bin/env ruby -wKU
2
+
3
+ module RandomPerson
4
+
5
+ require 'Names'
6
+
7
+ class ThaiRomanisedMaleFirst
8
+ include Names
9
+
10
+ #def names() NAMES; end
11
+
12
+ def initialize
13
+ @formats = {
14
+ :single => ->(n) { n.rand },
15
+ }
16
+
17
+ @formats_ratiod = [ (0..99)]
18
+ end
19
+
20
+ attr_accessor :formats, :formats_ratiod
21
+
22
+ def execute( person, format=nil )
23
+ if @formats.length > 1
24
+ r = rand(@formats_ratiod.last.end)
25
+ i = @formats_ratiod.index_in_range( r )
26
+ f = @formats.by_index(i).last
27
+ else
28
+ f = @formats[:single]
29
+ end
30
+ Names.execute( NAMES, f )
31
+ end
32
+
33
+
34
+ NAMES = %w{ Alak Ananda Annan Anuia Anuman Anurak Badinton Baharn Bahn Bapit Baroma Bhakdi Bhumipol Boon-Mee Boon-Nam Burimas Burut Cha Chai Chairat Chaiyanuchit Chaiyo Chakri Chalerm Chalermchai Changsai Chanthara Chao-Khun-Sa Chao-Tak Charoen Charoensom Charong Chatchalerm Chatchom Chatri Chaturon Chavalit Chesda Chomanan Chompoo Chongrak Choochai Choonhavan Choonhavon Chuachai Chuanchen Chuia Chula Chulalongkorn Chulamai Churai Chuthamani Daeng Darin Deng Dhipyamongkol Disnadda Ditaka Dithakar Dok Duchanee Emjaroen Erawan Fah Fufanwonich Gee Hainad Hanuman Intradit Ittiporn Jaidee Jao Jarunsuk Jatukamramthep Jayavarman Kamnan Kanda Karmatha Kasem Kasemchai Kasemsan Keetau Khakanang Khun Kiet Kit Kitti Kittibun Kittichai Kittichat Kittikchorn Kob Komalat Kongsampong Korn Kovit Kraisee Kraisingha Krarayoon Kriengsak Kris Krita Krom-Luang Kukrit Kusa Kwanchai Kwanjai Lamom Lamon Lap Leekpai Leekpie Lek Loesan Luk Maha Mahidol Malian Manitho Mee Mengrai Metananda Mok Mokkhavesa Mongkut Monyakul Muoi Nadee Nai-Thim Nak Nang-Klao Narai Naresuan Naris Narisa Net Ngam Nikom Nikon Nintau Niran Nit Noi Nongchai Noppadon Norachai Nuananong Nui Nung Nuta-Laya Obb Othong Pairat Paitoon Pakhdi Palat Panyarachun Paramendr Parnchand Pattama Pet Petchara Petchra Phaibun Phara Phinihan Phraisong Phrom-Borirak Phya Pichai Pichit Pira Pra Prachuab Pramoj Prasong Pravat Praves Praya Pricha Prisna Proi Pu Rachotai Rak Ramkamhaeng Rangsan Ratanankorn Ratsami Sajja Sanouk Santichai Sanun Sap Sarawong Sarit Sataheep Satrud Sawat Seni Si Siam Sinn Sombat Somchai Somdet-Ong-Yai Somdetch Sompron Son Songgram Soo Sook Sophuk Sri Srimuang Su Suda Sudarak Suk Sulak Sum Sumatra Sunan Sundaravej Suntarankul Sunti Sup Suphatra Suphayok Supoj Supp Supsampantuwongse Suriwongse Suriyawong Sutep Tai Tak-Sin Tam Tau Tep Tham-Boon Thammaraja Thanarat Thanit Thawanya Thawi Thongkon Thurdchai Ti Tiloka Ting Tinsulaananda Tinsulanonda Ton Tong Totsakan Toy Ubol Udom Unakan Vajiralongkorn Vajiravudh Vessandan Vidura Wasi Wattana Wiset Witsanunat Wongsa Xuwicha Yai Yhukon Yindee Yod Yongchaiyudh Yongchaiyuth Yubamrung }
35
+
36
+ end
37
+ end
data/lib/Names.rb ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby -wKU
2
+
3
+ module RandomPerson
4
+
5
+ module Names
6
+
7
+ def Names.execute( names, format=nil )
8
+ format = ->(n){ n.rand } if format.nil?
9
+ # puts format.inspect
10
+ format.( names )
11
+ end
12
+
13
+ end
14
+ end
data/lib/Person.rb ADDED
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby -wKU
2
+
3
+ module RandomPerson
4
+ class Person
5
+
6
+ attr_accessor :gender, :age, :dob, :first, :last, :prefix, :suffix
7
+
8
+ def initialize( h={} )
9
+ @gender = h[:gender] || nil
10
+ @age = h[:age] || nil
11
+ @dob = h[:dob] || nil
12
+ @first = h[:first] || nil
13
+ @last = h[:last] || nil
14
+ @prefix = h[:prefix] || nil
15
+ @suffix = h[:suffix] || nil
16
+ end
17
+
18
+ end
19
+ end
data/lib/Ratio.rb ADDED
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env ruby -wKU
2
+
3
+ module RandomPerson #namespace
4
+
5
+ module Ratio
6
+
7
+ #create a ratio that is made up of ranges
8
+ #to help hit with multiple valued ratios
9
+ def rangio( ratio=[1,1] )
10
+ sum = ratio.reduce(:+) #sum
11
+ mult = 100.divmod( sum ).first #get a bigger spread of numbers
12
+ ratio.map! { |n| n * mult }
13
+ new_ratio = ratio.inject([0..0]) {|acc,n| acc + [acc.last.last ... (n + acc.last.last)] }
14
+ new_ratio.shift #get rid of 0..0
15
+ return new_ratio
16
+ end
17
+
18
+ #find the order of magnitude of a number for use with this module
19
+ def ordmag( n )
20
+ m = 10
21
+ while m < 1000
22
+ break if n.divmod(m).first == 0
23
+ m *= 10
24
+ end
25
+ m
26
+ end
27
+
28
+ #use this method if you don't have a ratio at all for an array and, hey presto! It'll make one for you
29
+ def presto_rangio( len, mag )
30
+ return [ ] unless len >= 1
31
+ l, m = len, mag
32
+ lower = 0
33
+ presto = [ ]
34
+
35
+ while l > 0
36
+ # b = nil
37
+ upper = m - l
38
+ if l == 1
39
+ b = upper
40
+ else
41
+ b = rand( upper - lower ) + lower
42
+ end
43
+ presto << (lower..b)
44
+ lower = b + 1
45
+ l = l - 1
46
+ end
47
+ presto
48
+ end
49
+
50
+
51
+ end
52
+
53
+ end
data/lib/ext/Array.rb ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby -wKU
2
+
3
+ class Array
4
+
5
+ def index_in_range( n )
6
+ self.each_with_index do |x, i|
7
+ return i if x === n
8
+ end
9
+ return nil
10
+ end
11
+
12
+ def rand
13
+ self[Kernel.rand(length)]
14
+ end
15
+
16
+ end
data/lib/ext/Date.rb ADDED
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env ruby -wKU
2
+
3
+ require 'date'
4
+
5
+ class Date
6
+ def Date.days_in_month( year, month )
7
+ Date.civil(year, month, -1).day
8
+ end
9
+ end
10
+
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby -wKU
2
+
3
+ #add fold to the available method names
4
+ module Enumerable
5
+ alias :fold inject unless Enumerable.method_defined? :fold
6
+ end
data/lib/ext/Hash.rb ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby -wKU
2
+
3
+
4
+ class Hash
5
+ def by_index( n )
6
+ self.each_with_index { |item, index| break item if index == n }
7
+ end
8
+ end
9
+
data/lib/ext/Kernel.rb ADDED
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env ruby -wKU
2
+
3
+ module Kernel
4
+ def qualified_const_get(str)
5
+ path = str.to_s.split('::')
6
+ from_root = path[0].empty?
7
+ if from_root
8
+ from_root = []
9
+ path = path[1..-1]
10
+ else
11
+ start_ns = ((Class === self)||(Module === self)) ? self : self.class
12
+ from_root = start_ns.to_s.split('::')
13
+ end
14
+ until from_root.empty?
15
+ begin
16
+ return (from_root+path).inject(Object) { |ns,name| ns.const_get(name) }
17
+ rescue NameError
18
+ from_root.delete_at(-1)
19
+ end
20
+ end
21
+ path.inject(Object) { |ns,name| ns.const_get(name) }
22
+ end
23
+ end
data/lib/ext/Set.rb ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby -wKU
2
+
3
+ require 'set'
4
+
5
+ class Set
6
+
7
+ def classify_true( pattern )
8
+ self.classify{ |s| true if s =~ /#{pattern}/ }[true]
9
+ end
10
+
11
+ end
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby -wKU
2
+
3
+ #require all the scaffolding
4
+
5
+ HERE = File.dirname(__FILE__)
6
+
7
+ Dir.glob( File.join( HERE, 'ext', '*.rb' ) ).each do |file|
8
+ require file
9
+ end
10
+
11
+ Dir.glob( File.join( HERE, '*.rb' ) ).each do |file|
12
+ require file
13
+ end
@@ -0,0 +1,33 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{randomperson}
5
+ s.version = "0.0.1"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Iain Barnett"]
9
+ s.cert_chain = ["/Users/iainuser/.ssh/gem-public_cert.pem"]
10
+ s.date = %q{2010-08-20}
11
+ s.description = %q{A gem for generating random persons}
12
+ s.email = %q{iainspeed @nospam@ gmail.com}
13
+ s.extra_rdoc_files = ["README", "lib/Choice.rb", "lib/Generator.rb", "lib/NameFiles/AmericanLast.rb", "lib/NameFiles/AmericanMaleFirst.rb", "lib/NameFiles/AmericanSuffix.rb", "lib/NameFiles/AnyLast.rb", "lib/NameFiles/BasqueLast.rb", "lib/NameFiles/EnglishFemaleFirst.rb", "lib/NameFiles/EnglishLast.rb", "lib/NameFiles/EnglishPrefix.rb", "lib/NameFiles/SpanishFemaleFirst.rb", "lib/NameFiles/SpanishLast.rb", "lib/NameFiles/SpanishMaleFirst.rb", "lib/NameFiles/ThaiFirst.rb", "lib/NameFiles/ThaiRomanisedFemaleFirst.rb", "lib/NameFiles/ThaiRomanisedLast.rb", "lib/NameFiles/ThaiRomanisedMaleFirst.rb", "lib/Names.rb", "lib/Person.rb", "lib/Ratio.rb", "lib/ext/Array.rb", "lib/ext/Date.rb", "lib/ext/Enumerable.rb", "lib/ext/Hash.rb", "lib/ext/Kernel.rb", "lib/ext/Set.rb", "lib/randomperson.rb"]
14
+ s.files = ["Manifest", "README", "Rakefile", "lib/Choice.rb", "lib/Generator.rb", "lib/NameFiles/AmericanLast.rb", "lib/NameFiles/AmericanMaleFirst.rb", "lib/NameFiles/AmericanSuffix.rb", "lib/NameFiles/AnyLast.rb", "lib/NameFiles/BasqueLast.rb", "lib/NameFiles/EnglishFemaleFirst.rb", "lib/NameFiles/EnglishLast.rb", "lib/NameFiles/EnglishPrefix.rb", "lib/NameFiles/SpanishFemaleFirst.rb", "lib/NameFiles/SpanishLast.rb", "lib/NameFiles/SpanishMaleFirst.rb", "lib/NameFiles/ThaiFirst.rb", "lib/NameFiles/ThaiRomanisedFemaleFirst.rb", "lib/NameFiles/ThaiRomanisedLast.rb", "lib/NameFiles/ThaiRomanisedMaleFirst.rb", "lib/Names.rb", "lib/Person.rb", "lib/Ratio.rb", "lib/ext/Array.rb", "lib/ext/Date.rb", "lib/ext/Enumerable.rb", "lib/ext/Hash.rb", "lib/ext/Kernel.rb", "lib/ext/Set.rb", "lib/randomperson.rb", "t/Generator.t", "randomperson.gemspec"]
15
+ s.homepage = %q{http://github.com/yb66/RandomPerson}
16
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Randomperson", "--main", "README"]
17
+ s.require_paths = ["lib"]
18
+ s.required_ruby_version = Gem::Requirement.new(">= 1.9.1")
19
+ s.rubyforge_project = %q{randomperson}
20
+ s.rubygems_version = %q{1.3.7}
21
+ s.signing_key = %q{/Users/iainuser/.ssh/gem-private_key.pem}
22
+ s.summary = %q{A gem for generating random persons}
23
+
24
+ if s.respond_to? :specification_version then
25
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
26
+ s.specification_version = 3
27
+
28
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
29
+ else
30
+ end
31
+ else
32
+ end
33
+ end