onvkv_seteyoposecetv 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,260 @@
1
+ module Conjugators
2
+ module ActionVerbs
3
+ class PastOne
4
+ extend Conjugators::ActionVerbs::Shared
5
+ # SHORTEN, STRESS, ASPIRATE final vowel
6
+ def initialize(verb, irregular_pattern: nil)
7
+ @verb = verb
8
+
9
+ @irregular_pattern = irregular_pattern
10
+
11
+ raise "Invalid verb. Verb must end with 'etv'." unless @verb.end_with?("etv")
12
+
13
+ # verb stem is everything but the ending 'etv'
14
+ @verb_stem = @verb.gsub(/etv\z/, "")
15
+ @irregular = !!irregulars[@verb]
16
+ end
17
+
18
+ def conjugate!
19
+ {
20
+ verb: @verb,
21
+ first_person_singular: {
22
+ basic_past_one: conjugate(tense: :conjugate_1ps, type: :basic_past_one),
23
+ },
24
+ second_person_singular: {
25
+ basic_past_one: conjugate(tense: :conjugate_2ps, type: :basic_past_one),
26
+ },
27
+ third_person_singular: {
28
+ basic_past_one: conjugate(tense: :conjugate_3ps, type: :basic_past_one),
29
+ },
30
+ first_person_plural: {
31
+ basic_past_one: conjugate(tense: :conjugate_1pp, type: :basic_past_one),
32
+ },
33
+ second_person_plural: {
34
+ basic_past_one: conjugate(tense: :conjugate_2pp, type: :basic_past_one),
35
+ },
36
+ third_person_plural: {
37
+ basic_past_one: conjugate(tense: :conjugate_3pp, type: :basic_past_one),
38
+ }
39
+ }
40
+ end
41
+
42
+ private
43
+ def conjugate(type:, tense:)
44
+ case type
45
+ when :basic_past_one
46
+ result = send(tense)
47
+ if result[0].is_a?(String)
48
+ [result.map {|r| r + ?s }]
49
+ else
50
+ if @irregular
51
+ case result.size
52
+ when 1
53
+ rr_2plus = result[0].map {|r| "#{r}s (of 2+)"}
54
+ [rr_2plus]
55
+ when 2
56
+ rr2 = result[0].map {|r| "#{r}s (of 2)" }
57
+ rr3_plus = result[1].map {|r| "#{r}s (of 3+)"}
58
+ [rr2, rr3_plus]
59
+ end
60
+ else
61
+ result.map do |verb_form|
62
+ verb_form.map do |dialectic_option|
63
+ "#{dialectic_option}s"
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
70
+
71
+ def conjugating_each_dialectic_option(dialectic_person_marker_options)
72
+ dialectic_person_marker_options.map do |person_marker|
73
+ yield(person_marker)
74
+ end
75
+ end
76
+
77
+ def conjugate_1ps
78
+ conjugating_each_dialectic_option(self.class.person_markers['1ps']) do |person_marker|
79
+ @verb_to_conjugate = @verb.dup
80
+ drop_the_etv!
81
+ hgrade_final_vowel!
82
+ add_person_marker!(person_marker)
83
+ end
84
+ end
85
+
86
+ def conjugate_2ps
87
+ conjugating_each_dialectic_option(self.class.person_markers['2ps']) do |person_marker|
88
+ @verb_to_conjugate = @verb.dup
89
+ drop_the_etv!
90
+ hgrade_final_vowel!
91
+ add_person_marker!(person_marker)
92
+ end
93
+ end
94
+
95
+ def conjugate_3ps
96
+ conjugating_each_dialectic_option(self.class.person_markers['3ps']) do |person_marker|
97
+ @verb_to_conjugate = @verb.dup
98
+ drop_the_etv!
99
+ hgrade_final_vowel!
100
+ add_person_marker!(person_marker)
101
+ end
102
+ end
103
+
104
+ def conjugate_1pp
105
+ results = []
106
+ if plural_forms = self.class.irregulars[@verb]&.values_at(2,3)&.compact
107
+ plural_forms.each do |verb|
108
+ results << conjugating_each_dialectic_option(self.class.person_markers['1pp']) do |person_marker|
109
+ @verb_to_conjugate = verb.dup
110
+ drop_the_etv!
111
+ hgrade_final_vowel!
112
+ add_person_marker!(person_marker)
113
+ end
114
+ end
115
+ else
116
+ results << conjugating_each_dialectic_option(self.class.person_markers['1pp']) do |person_marker|
117
+ @verb_to_conjugate = @verb.dup
118
+ drop_the_etv!
119
+ hgrade_final_vowel!
120
+ add_person_marker!(person_marker)
121
+ end
122
+ end
123
+
124
+ results
125
+ end
126
+
127
+ def conjugate_2pp
128
+ results = []
129
+ if plural_forms = self.class.irregulars[@verb]&.values_at(2,3)&.compact
130
+ plural_forms.each do |verb|
131
+ results << conjugating_each_dialectic_option(self.class.person_markers['2pp']) do |person_marker|
132
+ @verb_to_conjugate = verb.dup
133
+ drop_the_etv!
134
+ hgrade_final_vowel!
135
+ add_person_marker!(person_marker)
136
+ end
137
+ end
138
+ else
139
+ results << conjugating_each_dialectic_option(self.class.person_markers['2pp']) do |person_marker|
140
+ @verb_to_conjugate = @verb.dup
141
+ drop_the_etv!
142
+ hgrade_final_vowel!
143
+ add_person_marker!(person_marker)
144
+ end
145
+ end
146
+
147
+ results
148
+ end
149
+
150
+ # this is the -ake one. have learned that when adding ake
151
+ def conjugate_3pp
152
+ results = []
153
+ if plural_forms = self.class.irregulars[@verb]&.values_at(2,3)&.compact
154
+ plural_forms.each do |verb|
155
+ results << conjugating_each_dialectic_option(self.class.person_markers['3pp']) do |person_marker|
156
+ @verb_to_conjugate = verb.dup
157
+ drop_the_etv!
158
+
159
+ if person_marker == 'ake' && identify_hgrade_form(@verb_to_conjugate) == :basic
160
+ @verb_to_conjugate += "ak"
161
+ hgrade_final_vowel!
162
+ @verb_to_conjugate += "e"
163
+ else
164
+ hgrade_final_vowel!
165
+ add_person_marker!(person_marker)
166
+ end
167
+ end
168
+ end
169
+ else
170
+ results << conjugating_each_dialectic_option(self.class.person_markers['3pp']) do |person_marker|
171
+ @verb_to_conjugate = @verb.dup
172
+ drop_the_etv!
173
+
174
+ if person_marker == 'ake' && identify_hgrade_form(@verb_to_conjugate) == :basic
175
+ @verb_to_conjugate += "ak"
176
+ hgrade_final_vowel!
177
+ @verb_to_conjugate += "e"
178
+ else
179
+ hgrade_final_vowel!
180
+ add_person_marker!(person_marker)
181
+ end
182
+ end
183
+ end
184
+
185
+ results
186
+ end
187
+
188
+ def drop_the_etv!
189
+ @verb_to_conjugate.gsub!(/etv\z/, "")
190
+ end
191
+
192
+ def irregulars
193
+ self.class.irregulars
194
+ end
195
+
196
+ def hgrade_final_vowel!
197
+ final_vowel_index = @verb_to_conjugate.rindex(/[aeēiov]/)
198
+ hgrade_form = identify_hgrade_form(@verb_to_conjugate)
199
+
200
+ if hgrade_form == :basic
201
+ final_vowel = @verb_to_conjugate[final_vowel_index]
202
+ h_graded_final_vowel = self.class.basic_hgrades[final_vowel]
203
+
204
+ @verb_to_conjugate[final_vowel_index] = h_graded_final_vowel
205
+
206
+ elsif hgrade_form == :double_consonant
207
+
208
+ @verb_to_conjugate[-1] = 'iy' #e.g. kerr -> keriy
209
+ elsif hgrade_form == :kk_or_consonant_cluster
210
+
211
+ @verb_to_conjugate[-1] = "i#{@verb_to_conjugate[-1]}" #e.g. homp -> homip
212
+ end
213
+
214
+ @verb_to_conjugate
215
+ end
216
+
217
+ def identify_hgrade_form(verb)
218
+ final_vowel_index = verb.rindex(/[aeēiouv]/)
219
+
220
+ # what is to the right of that final vowel
221
+ to_the_right = verb[final_vowel_index + 1..-1]
222
+
223
+ alphabet = %w{ a c e ē f h i k l m n o p r s t u v w y }
224
+ vowels = %w{ a e ē i o u v }
225
+ consonants = alphabet - vowels
226
+
227
+ # we have a few cases of concern for `to_the_right`
228
+ # 1. Consonant Cluster: 'kk' or two consonants that aren't the same (e.g. 'tk', 'mp', etc.)
229
+ # 2. Double Consonant, not KK: repeated consonants, except 'kk' (e.g. 'pp', 'tt', 'ff', etc.)
230
+ # 3. Basic: everything else
231
+ double_consonant = to_the_right.match?(/\A(?!kk)(\w)\1\z/)
232
+ kk = to_the_right.match?(/\Akk\z/)
233
+ consonant_cluster = to_the_right.match?(/\A(#{consonants.join('|')}){2,}\z/)
234
+ basic = !double_consonant && !kk && !consonant_cluster
235
+
236
+ return form = :double_consonant if double_consonant
237
+ return form = :kk_or_consonant_cluster if kk || consonant_cluster
238
+ return form = :basic if basic
239
+
240
+ raise "Unrecognized verb form"
241
+ end
242
+
243
+ def self.basic_hgrades
244
+ {
245
+ 'a' => 'vh',
246
+ 'e' => 'eh',
247
+ 'ē' => 'eh',
248
+ 'i' => 'ih',
249
+ 'o' => 'oh',
250
+ 'u' => 'uh',
251
+ 'v' => 'vh',
252
+ }
253
+ end
254
+
255
+ def add_person_marker!(person_marker)
256
+ @verb_to_conjugate += person_marker
257
+ end
258
+ end
259
+ end
260
+ end
@@ -0,0 +1,294 @@
1
+ module Conjugators
2
+ module ActionVerbs
3
+ class PastThree
4
+ extend Conjugators::ActionVerbs::Shared
5
+ # Note, MVSKOKE language here
6
+ def initialize(verb)
7
+ @verb = verb
8
+
9
+ raise "Invalid verb. Verb must end with 'etv'." unless @verb.end_with?("etv")
10
+
11
+ @irregular = !!irregulars[@verb]
12
+ end
13
+
14
+ def conjugate!
15
+ {
16
+ verb: @verb,
17
+ first_person_singular: {
18
+ basic: conjugate(tense: :conjugate_1ps, type: :basic),
19
+ tos_auxiliary: conjugate(tense: :conjugate_1ps, type: :tos_auxiliary),
20
+ ometv_conjugated_auxiliary: conjugate(tense: :conjugate_1ps, type: :ometv_conjugated_auxiliary)
21
+ },
22
+ second_person_singular: {
23
+ basic: conjugate(tense: :conjugate_2ps, type: :basic),
24
+ tos_auxiliary: conjugate(tense: :conjugate_2ps, type: :tos_auxiliary),
25
+ ometv_conjugated_auxiliary: conjugate(tense: :conjugate_2ps, type: :ometv_conjugated_auxiliary)
26
+ },
27
+ third_person_singular: {
28
+ basic: conjugate(tense: :conjugate_3ps, type: :basic),
29
+ tos_auxiliary: conjugate(tense: :conjugate_3ps, type: :tos_auxiliary),
30
+ ometv_conjugated_auxiliary: conjugate(tense: :conjugate_3ps, type: :ometv_conjugated_auxiliary)
31
+ },
32
+ first_person_plural: {
33
+ basic: conjugate(tense: :conjugate_1pp, type: :basic),
34
+ tos_auxiliary: conjugate(tense: :conjugate_1pp, type: :tos_auxiliary),
35
+ ometv_conjugated_auxiliary: conjugate(tense: :conjugate_1pp, type: :ometv_conjugated_auxiliary)
36
+ },
37
+ second_person_plural: {
38
+ basic: conjugate(tense: :conjugate_2pp, type: :basic),
39
+ tos_auxiliary: conjugate(tense: :conjugate_2pp, type: :tos_auxiliary),
40
+ ometv_conjugated_auxiliary: conjugate(tense: :conjugate_2pp, type: :ometv_conjugated_auxiliary)
41
+ },
42
+ third_person_plural: {
43
+ basic: conjugate(tense: :conjugate_3pp, type: :basic),
44
+ tos_auxiliary: conjugate(tense: :conjugate_3pp, type: :tos_auxiliary),
45
+ ometv_conjugated_auxiliary: conjugate(tense: :conjugate_3pp, type: :ometv_conjugated_auxiliary)
46
+ }
47
+ }
48
+ end
49
+
50
+ private
51
+ def conjugate(type:, tense:)
52
+ @type = type
53
+ case type
54
+ when :basic
55
+ result = send(tense)
56
+ if result[0].is_a?(String)
57
+ [result.map {|r| r + ?s }]
58
+ else
59
+ if @irregular
60
+ case result.size
61
+ when 1
62
+ rr_2plus = result[0].map {|r| "#{r}s (of 2+)"}
63
+ [rr_2plus]
64
+ when 2
65
+ rr2 = result[0].map {|r| "#{r}s (of 2)" }
66
+ rr3_plus = result[1].map {|r| "#{r}s (of 3+)"}
67
+ [rr2, rr3_plus]
68
+ end
69
+ else
70
+ result.map do |verb_form|
71
+ verb_form.map do |dialectic_option|
72
+ "#{dialectic_option}s"
73
+ end
74
+ end
75
+ end
76
+ end
77
+ when :tos_auxiliary
78
+ return "N/A" if @verb == "ometv" || @verb == "owetv"
79
+ result = send(tense)
80
+ if result[0].is_a?(String)
81
+ [result.map {|r| r + " towemvts" }]
82
+ else
83
+ if @irregular
84
+ case result.size
85
+ when 1
86
+ rr_2plus = result[0].map {|r| "#{r} towemvts (of 2+)" }
87
+ [rr_2plus]
88
+ when 2
89
+ rr2 = result[0].map {|r| "#{r} towemvts (of 2)" }
90
+ rr3_plus = result[1].map {|r| "#{r} towemvts (of 3+)"}
91
+ [rr2, rr3_plus]
92
+ end
93
+ else
94
+ result.map do |verb_form|
95
+ verb_form.map do |dialectic_option|
96
+ "#{dialectic_option} towemvts"
97
+ end
98
+ end
99
+ end
100
+ end
101
+ when :ometv_conjugated_auxiliary
102
+ return "N/A" if @verb == "ometv" || @verb == "owetv"
103
+ result = ometv(tense.to_s.split(?_).last)
104
+
105
+ # Do we need towakes? Right now believing so (even if the verb is plural already???)
106
+ #result.map! {|r| r.gsub("towakes", "tos") } if @irregular
107
+
108
+ verbs_to_conjugate = if self.class.irregulars[@verb] && tense =~ /p\z/
109
+ self.class.irregulars[@verb].values_at(2,3).compact
110
+ else
111
+ @verb
112
+ end
113
+ results = if verbs_to_conjugate.is_a?(String)
114
+ [result.map {|r| verbs_to_conjugate.gsub(/etv\z/, 'e ') + r }]
115
+ else
116
+ verbs_to_conjugate.map do |verb_to_conjugate|
117
+ result.map {|r| verb_to_conjugate.gsub(/etv\z/, 'e ') + r }
118
+ end
119
+ end
120
+ if verbs_to_conjugate == @verb
121
+ return results
122
+ end
123
+ if tense =~ /s\z/
124
+ results
125
+ else
126
+ case results.size
127
+ when 1
128
+ rr_2plus = results[0].map {|r| "#{r} (of 2+)"}
129
+ [rr_2plus]
130
+ when 2
131
+ rr2 = results[0].map {|r| "#{r} (of 2)" }
132
+ rr3_plus = results[1].map {|r| "#{r} (of 3+)"}
133
+ [rr2, rr3_plus]
134
+ end
135
+ end
136
+ end
137
+ end
138
+
139
+ def conjugating_each_dialectic_option(dialectic_person_marker_options)
140
+ dialectic_person_marker_options.map do |person_marker|
141
+ yield(person_marker)
142
+ end
143
+ end
144
+
145
+ def conjugate_1ps
146
+ conjugating_each_dialectic_option(person_markers['1ps']) do |person_marker|
147
+ @verb_to_conjugate = @verb.dup
148
+ drop_the_etv!
149
+ add_person_marker!(person_marker)
150
+ end
151
+ end
152
+
153
+ def conjugate_2ps
154
+ conjugating_each_dialectic_option(person_markers['2ps']) do |person_marker|
155
+ @verb_to_conjugate = @verb.dup
156
+ drop_the_etv!
157
+ add_person_marker!(person_marker)
158
+ end
159
+ end
160
+
161
+ def conjugate_3ps
162
+ conjugating_each_dialectic_option(person_markers['3ps']) do |person_marker|
163
+ @verb_to_conjugate = @verb.dup
164
+ drop_the_etv!
165
+ add_person_marker!(person_marker)
166
+ end
167
+ end
168
+
169
+ def conjugate_1pp
170
+ results = []
171
+ if plural_forms = self.class.irregulars[@verb]&.values_at(2,3)&.compact
172
+ plural_forms.each do |verb|
173
+ results << conjugating_each_dialectic_option(person_markers['1pp']) do |person_marker|
174
+ @verb_to_conjugate = verb.dup
175
+ drop_the_etv!
176
+
177
+ if @type == :tos_auxiliary
178
+ @verb_to_conjugate + 'eyē'
179
+ else
180
+ add_person_marker!(person_marker)
181
+ end
182
+
183
+ end
184
+ end
185
+ else
186
+ results << conjugating_each_dialectic_option(person_markers['1pp']) do |person_marker|
187
+ @verb_to_conjugate = @verb.dup
188
+ drop_the_etv!
189
+ if @type == :tos_auxiliary
190
+ @verb_to_conjugate + 'eyē'
191
+ else
192
+ add_person_marker!(person_marker)
193
+ end
194
+ end
195
+ end
196
+
197
+ results
198
+ end
199
+
200
+ def conjugate_2pp
201
+ results = []
202
+ if plural_forms = self.class.irregulars[@verb]&.values_at(2,3)&.compact
203
+ plural_forms.each do |verb|
204
+ results << conjugating_each_dialectic_option(person_markers['2pp']) do |person_marker|
205
+ @verb_to_conjugate = verb.dup
206
+ drop_the_etv!
207
+ add_person_marker!(person_marker)
208
+ end
209
+ end
210
+ else
211
+ results << conjugating_each_dialectic_option(person_markers['2pp']) do |person_marker|
212
+ @verb_to_conjugate = @verb.dup
213
+ drop_the_etv!
214
+ add_person_marker!(person_marker)
215
+ end
216
+ end
217
+
218
+ results
219
+ end
220
+
221
+ def conjugate_3pp
222
+ results = []
223
+ if plural_forms = self.class.irregulars[@verb]&.values_at(2,3)&.compact
224
+ plural_forms.each do |verb|
225
+ results << conjugating_each_dialectic_option(person_markers['3pp']) do |person_marker|
226
+ @verb_to_conjugate = verb.dup
227
+ drop_the_etv!
228
+
229
+ if @type == :tos_auxiliary
230
+ @verb_to_conjugate + 'ē'
231
+ else
232
+ @verb_to_conjugate + 'vnk'
233
+ end
234
+
235
+ # don't need 'ak' in 'akes' because it's already plural
236
+ end
237
+ end
238
+ else
239
+ results << conjugating_each_dialectic_option(person_markers['3pp']) do |person_marker|
240
+ @verb_to_conjugate = @verb.dup
241
+ drop_the_etv!
242
+ add_person_marker!(person_marker)
243
+ end
244
+ end
245
+
246
+ results
247
+ end
248
+
249
+ def drop_the_etv!
250
+ @verb_to_conjugate.gsub!(/etv\z/, "")
251
+ end
252
+
253
+ def consonants
254
+ %w{ c f h k l m n p r s t w }
255
+ end
256
+
257
+ def irregulars
258
+ self.class.irregulars
259
+ end
260
+
261
+ def add_person_marker!(person_marker)
262
+ if @type == :tos_auxiliary
263
+ (@verb_to_conjugate + person_marker).gsub(/e$/, 'ē').gsub(/i$/, "iyē")
264
+ else
265
+ @verb_to_conjugate + person_marker
266
+ end
267
+ end
268
+
269
+ def ometv(tense)
270
+ Conjugators::Ometv::PastThree.new(tense).conjugate![tense]
271
+ end
272
+
273
+ def self.past_two_person_markers
274
+ {
275
+ '1ps' => %w{ imvt },
276
+ '2ps' => %w{ etskemvt eckemvt eccemvt etcemvt },
277
+ '3ps' => %w{ emvt }, # (e)
278
+ '1pp' => %w{ ēyemvt },
279
+ '2pp' => %w{ atskemvt ackemvt },
280
+ '3pp' => %w{ akemvt }, # ak(e) *
281
+ }
282
+ end
283
+
284
+ def person_markers
285
+ if @type == :basic
286
+ self.class.past_two_person_markers
287
+ else
288
+ self.class.person_markers
289
+ end
290
+ end
291
+
292
+ end
293
+ end
294
+ end