-
Notifications
You must be signed in to change notification settings - Fork 0
/
gender.go
197 lines (176 loc) · 3.5 KB
/
gender.go
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
package model
const (
GenderMale = "man"
GenderFemale = "woman"
GenderUnknown = "unknown"
)
type Gender string
func (g Gender) IsMale() bool {
return g == GenderMale
}
func (g Gender) IsFemale() bool {
return g == GenderFemale
}
func (g Gender) IsUnknown() bool {
return g == GenderUnknown
}
func (g Gender) Opposite() Gender {
switch g {
case GenderMale:
return GenderFemale
case GenderFemale:
return GenderMale
default:
return GenderUnknown
}
}
func (g Gender) Noun() string {
switch g {
case GenderMale:
return "man"
case GenderFemale:
return "woman"
default:
return "person"
}
}
func (g Gender) ChildNoun() string {
switch g {
case GenderMale:
return "boy"
case GenderFemale:
return "girl"
default:
return "child"
}
}
// RelationToParentNoun returns the general noun to use for parent relation: son/daughter or child if gender is unknown (this person is the ___ of their parent)
func (g Gender) RelationToParentNoun() string {
switch g {
case GenderMale:
return "son"
case GenderFemale:
return "daughter"
default:
return "child"
}
}
// RelationToChildrenNoun returns the general noun to use for child relation: father/mother or parent if gender is unknown (this person is the ___ of their child)
func (g Gender) RelationToChildrenNoun() string {
switch g {
case GenderMale:
return "father"
case GenderFemale:
return "mother"
default:
return "parent"
}
}
// RelationToSpouseNoun returns the general noun to use for spouse relation: husband/wife or spouse if gender is unknown (this person is the ___ of their spouse)
func (g Gender) RelationToSpouseNoun() string {
switch g {
case GenderMale:
return "husband"
case GenderFemale:
return "wife"
default:
return "spouse"
}
}
func (g Gender) RelationToSpouseNounPlural() string {
switch g {
case GenderMale:
return "husbands"
case GenderFemale:
return "wives"
default:
return "spouses"
}
}
// RelationToSpouseNoun returns the general noun to use for sibling relation: brother/sister or sibling if gender is unknown (this person is the ___ of their sibling)
func (g Gender) RelationToSiblingNoun() string {
switch g {
case GenderMale:
return "brother"
case GenderFemale:
return "sister"
default:
return "sibling"
}
}
func (g Gender) SubjectPronoun() string {
switch g {
case GenderMale:
return "he"
case GenderFemale:
return "she"
default:
return "they"
}
}
func (g Gender) SubjectPronounWithLink() string {
switch g {
case GenderMale:
return "he was"
case GenderFemale:
return "she was"
default:
return "they were"
}
}
func (g Gender) PossessivePronounSingular() string {
switch g {
case GenderMale:
return "his"
case GenderFemale:
return "her"
default:
return "their"
}
}
func (g Gender) PossessivePronounPlural() string {
switch g {
case GenderMale:
return "his"
case GenderFemale:
return "hers"
default:
return "theirs"
}
}
func (g Gender) ObjectPronoun() string {
switch g {
case GenderMale:
return "him"
case GenderFemale:
return "her"
default:
return "them"
}
}
func (g Gender) ReflexivePronoun() string {
switch g {
case GenderMale:
return "himself"
case GenderFemale:
return "herself"
default:
return "themselves"
}
}
// WidowWidower returns a word that fits the sentence:
// "when their spouse died, x was left a <widow/widower>"
func (g Gender) WidowWidower() string {
switch g {
case GenderMale:
return "widower"
case GenderFemale:
return "widow"
default:
return "widow"
}
}
type Link struct {
Title string
URL string
}