aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/icrowley/fake/names.go
blob: fde3eaf20450ff9a35d524f0a6c437171666db73 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
package fake

func randGender() string {
	g := "male"
	if r.Intn(2) == 0 {
		g = "female"
	}
	return g
}

func firstName(gender string) string {
	return lookup(lang, gender+"_first_names", true)
}

// MaleFirstName generates male first name
func MaleFirstName() string {
	return firstName("male")
}

// FemaleFirstName generates female first name
func FemaleFirstName() string {
	return firstName("female")
}

// FirstName generates first name
func FirstName() string {
	return firstName(randGender())
}

func lastName(gender string) string {
	return lookup(lang, gender+"_last_names", true)
}

// MaleLastName generates male last name
func MaleLastName() string {
	return lastName("male")
}

// FemaleLastName generates female last name
func FemaleLastName() string {
	return lastName("female")
}

// LastName generates last name
func LastName() string {
	return lastName(randGender())
}

func patronymic(gender string) string {
	return lookup(lang, gender+"_patronymics", false)
}

// MalePatronymic generates male patronymic
func MalePatronymic() string {
	return patronymic("male")
}

// FemalePatronymic generates female patronymic
func FemalePatronymic() string {
	return patronymic("female")
}

// Patronymic generates patronymic
func Patronymic() string {
	return patronymic(randGender())
}

func prefix(gender string) string {
	return lookup(lang, gender+"_name_prefixes", false)
}

func suffix(gender string) string {
	return lookup(lang, gender+"_name_suffixes", false)
}

func fullNameWithPrefix(gender string) string {
	return join(prefix(gender), firstName(gender), lastName(gender))
}

// MaleFullNameWithPrefix generates prefixed male full name
// if prefixes for the given language are available
func MaleFullNameWithPrefix() string {
	return fullNameWithPrefix("male")
}

// FemaleFullNameWithPrefix generates prefixed female full name
// if prefixes for the given language are available
func FemaleFullNameWithPrefix() string {
	return fullNameWithPrefix("female")
}

// FullNameWithPrefix generates prefixed full name
// if prefixes for the given language are available
func FullNameWithPrefix() string {
	return fullNameWithPrefix(randGender())
}

func fullNameWithSuffix(gender string) string {
	return join(firstName(gender), lastName(gender), suffix(gender))
}

// MaleFullNameWithSuffix generates suffixed male full name
// if suffixes for the given language are available
func MaleFullNameWithSuffix() string {
	return fullNameWithPrefix("male")
}

// FemaleFullNameWithSuffix generates suffixed female full name
// if suffixes for the given language are available
func FemaleFullNameWithSuffix() string {
	return fullNameWithPrefix("female")
}

// FullNameWithSuffix generates suffixed full name
// if suffixes for the given language are available
func FullNameWithSuffix() string {
	return fullNameWithPrefix(randGender())
}

func fullName(gender string) string {
	switch r.Intn(10) {
	case 0:
		return fullNameWithPrefix(gender)
	case 1:
		return fullNameWithSuffix(gender)
	default:
		return join(firstName(gender), lastName(gender))
	}
}

// MaleFullName generates male full name
// it can occasionally include prefix or suffix
func MaleFullName() string {
	return fullName("male")
}

// FemaleFullName generates female full name
// it can occasionally include prefix or suffix
func FemaleFullName() string {
	return fullName("female")
}

// FullName generates full name
// it can occasionally include prefix or suffix
func FullName() string {
	return fullName(randGender())
}