JayVerb 0.0.0

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,1521 @@
1
+ module Japanese
2
+ module Conjugator
3
+ # List with complete list of exceptions for
4
+ # consonant verbs that end in -eru -iru at: https://en.wikipedia.org/wiki/Japanese_consonant_and_vowel_verbs#List_of_consonant_stem_verbs_ending_in_iru
5
+
6
+ POLITE_VERB_ENDINGS = {present: "ます",
7
+ past: "ました",
8
+ present_negative: "ません",
9
+ past_negative: "ませんでした",
10
+ volitional: "ましょう",
11
+ te_form: "まして"
12
+ }
13
+ NEGATIVE_VERB_ENDINGS = { present: "ない",
14
+ past: "なかった",
15
+ te_form: "なくて"
16
+ }
17
+
18
+ CONTINUOUS_ENDINGS = { present_spoken: "る",
19
+ present_written: "いる",
20
+ present_polite: "います",
21
+ present_polite_spoken: "ます",
22
+ past_spoken: "た",
23
+ past_written: "いた",
24
+ past_polite: "いました",
25
+ past_polite_spoken: "ました",
26
+ te_form_spoken: "て",
27
+ te_form_written: "いて",
28
+ te_form_polite: "いまして",
29
+ te_form_polite_spoken: "まして",
30
+ negative_te_form_spoken: "なくて",
31
+ negative_te_form_written: "いなくて"
32
+ }
33
+
34
+ ROMAJI_POLITE_VERB_ENDINGS = { present: "masu",
35
+ past: "mashita",
36
+ present_negative: "masen",
37
+ past_negative: "masen deshita",
38
+ volitional: "masho",
39
+ te_form: "mashite"
40
+ }
41
+
42
+ ROMAJI_NEGATIVE_VERB_ENDINGS = { present: "nai",
43
+ past: "nakatta",
44
+ te_form: "nakute"
45
+ }
46
+
47
+ ROMAJI_CONTINUOUS_ENDINGS = { present_spoken: "ru",
48
+ present_written: " iru",
49
+ present_polite: " imasu",
50
+ present_polite_spoken: "masu",
51
+ past_spoken: "ta",
52
+ past_written: " ita",
53
+ past_polite: " imashita",
54
+ past_polite_spoken: "mashita",
55
+ te_form_spoken: "te",
56
+ te_form_written: " ite",
57
+ te_form_polite: " imashite",
58
+ te_form_polite_spoken: "mashite",
59
+ negative_te_form_spoken: "nakute",
60
+ negative_te_form_written: " inakute"
61
+ }
62
+
63
+ VERB_CLASSES = %w(v1 v5b v5g v5k v5k-s v5m v5n v5r v5r-i v5s v5t v5u v5u-s v-aru v-kuru v-suru)
64
+
65
+ def process_verb
66
+ if Japanese::Conjugator::VERB_CLASSES.include?(self.part_of_speech)
67
+ unless ambiguous? # <= Method from JapaneseVerbIdentifier module
68
+ set_verb_stem_form
69
+ set_negative_stem
70
+ set_base
71
+ set_te_form
72
+ set_ta_form
73
+ set_polite_form_conjugations
74
+ set_negative_plain_forms
75
+ set_continuous_forms
76
+ set_prohibitive_form
77
+ set_plain_present_potential
78
+ set_conditional
79
+ set_imperative
80
+ set_volitional
81
+ set_passive_dictionary_form
82
+ set_passive_forms_hash
83
+ set_causative_dictionary_form
84
+ set_causative_forms_hash
85
+ set_causative_passive_dictionary_form
86
+ set_causative_passive_forms_hash
87
+ end
88
+ end
89
+ # self.save => Keep this commented out for now to experiment around in the console.
90
+ end
91
+
92
+
93
+ # Makes up for the fact that v5u verb endings are represented by one Roman letter as opposed to the
94
+ # verb endings of every other class, which are represented by two Roman letters.
95
+ def romaji_conditional_slice(string)
96
+ if self.part_of_speech == "v5u" || self.part_of_speech == "v5u-s"
97
+ string.slice!(-1)
98
+ else
99
+ string.slice!(-2..-1)
100
+ end
101
+ end
102
+
103
+ def set_verb_stem_form
104
+ stem = self.kanji.dup
105
+ hiragana_stem = self.hiragana.dup
106
+ romaji_stem = self.romaji.dup
107
+ stem.slice!(-1)
108
+ hiragana_stem.slice!(-1)
109
+ romaji_conditional_slice(romaji_stem)
110
+ # Fill in the logic to figure out what stem ending to add
111
+ case self.part_of_speech
112
+ when "v1"
113
+ stem
114
+ when "v5b"
115
+ stem += "び"
116
+ hiragana_stem += "び"
117
+ romaji_stem += "bi"
118
+ when "v5k"
119
+ stem += "き"
120
+ hiragana_stem += "き"
121
+ romaji_stem += "ki"
122
+ when "v5k-s"
123
+ stem += "き"
124
+ hiragana_stem += "き"
125
+ romaji_stem += "ki"
126
+ when "v5g"
127
+ stem += "ぎ"
128
+ hiragana_stem += "ぎ"
129
+ romaji_stem += "gi"
130
+ when "v5m"
131
+ stem += "み"
132
+ hiragana_stem += "み"
133
+ romaji_stem += "mi"
134
+ when "v5n"
135
+ stem += "に"
136
+ hiragana_stem += "に"
137
+ romaji_stem += "ni"
138
+ when "v5r"
139
+ stem += "り"
140
+ hiragana_stem += "り"
141
+ romaji_stem += "ri"
142
+ when "v5r-i"
143
+ stem # Assuming this class is for いらっしゃる => いらっしゃ would be the stem
144
+ when "v5s"
145
+ stem += "し"
146
+ hiragana_stem += "し"
147
+ romaji_stem += "shi"
148
+ when "v5t"
149
+ stem += "ち"
150
+ hiragana_stem += "ち"
151
+ romaji_stem += "chi"
152
+ when "v5u"
153
+ stem += "い"
154
+ hiragana_stem += "い"
155
+ romaji_stem += "i"
156
+ when "v5u-s"
157
+ stem += "い" # Assuming this class is for the irregular 問う => 問い would be the stem
158
+ hiragana_stem += "い"
159
+ romaji_stem += "i"
160
+ when "v-kuru"
161
+ stem # Assuming that you enter this in kanji; this will not work in hiragana.
162
+ when "v-suru"
163
+ stem = "し"
164
+ hiragana_stem = "し"
165
+ romaji_stem = "shi"
166
+ when "v-aru"
167
+ stem += "り"
168
+ hiragana_stem += "り"
169
+ romaji_stem += "ri"
170
+ end
171
+ self.stem_form = stem
172
+ self.hiragana_forms[:stem] = hiragana_stem
173
+ self.romaji_forms[:stem] = romaji_stem
174
+ # kanji.save! => Comment this out now for experimental purposes
175
+ end
176
+
177
+ def set_negative_stem
178
+ stem = self.kanji.dup
179
+ hiragana_stem = self.hiragana.dup
180
+ romaji_stem = self.romaji.dup
181
+ stem.slice!(-1)
182
+ hiragana_stem.slice!(-1)
183
+ romaji_conditional_slice(romaji_stem)
184
+ case self.part_of_speech
185
+ when "v1"
186
+ stem
187
+ when "v5b"
188
+ stem += "ば"
189
+ hiragana_stem += "ば"
190
+ romaji_stem += "ba"
191
+ when "v5k"
192
+ stem += "か"
193
+ hiragana_stem += "か"
194
+ romaji_stem += "ka"
195
+ when "v5k-s"
196
+ stem += "か"
197
+ hiragana_stem += "か"
198
+ romaji_stem += "ka"
199
+ when "v5g"
200
+ stem += "が"
201
+ hiragana_stem += "が"
202
+ romaji_stem += "ga"
203
+ when "v5m"
204
+ stem += "ま"
205
+ hiragana_stem += "ま"
206
+ romaji_stem += "ma"
207
+ when "v5n"
208
+ stem += "な"
209
+ hiragana_stem += "な"
210
+ romaji_stem += "na"
211
+ when "v5r"
212
+ stem += "ら"
213
+ hiragana_stem += "ら"
214
+ romaji_stem += "ra"
215
+ when "v5r-i"
216
+ stem += "ら" # Assuming this class is for いらっしゃる, いらっしゃら would be the stem
217
+ hiragana_stem += "ら"
218
+ romaji_stem += "ra"
219
+ when "v5s"
220
+ stem += "さ"
221
+ hiragana_stem += "さ"
222
+ romaji_stem += "sa"
223
+ when "v5t"
224
+ stem += "た"
225
+ hiragana_stem += "た"
226
+ romaji_stem += "ta"
227
+ when "v5u"
228
+ stem += "わ"
229
+ hiragana_stem += "わ"
230
+ romaji_stem += "wa"
231
+ when "v5u-s"
232
+ stem += "わ" # Assuming this class is for the irregular 問う, 問い would be the stem
233
+ hiragana_stem += "わ"
234
+ romaji_stem += "wa"
235
+ when "v-kuru"
236
+ hiragana_stem = "こ"
237
+ romaji_stem = "ko"
238
+ when "v-suru"
239
+ stem = "し"
240
+ hiragana_stem = "し"
241
+ romaji_stem = "shi"
242
+ when "v-aru"
243
+ stem = ""
244
+ hiragana_stem = ""
245
+ romaji_stem = ""
246
+ end
247
+ self.negative_stem = stem
248
+ self.hiragana_forms[:negative_stem] = hiragana_stem
249
+ self.romaji_forms[:negative_stem] = romaji_stem
250
+ end
251
+
252
+ def set_base
253
+ kanji = self.kanji.dup
254
+ hiragana_word = self.hiragana.dup
255
+ romaji_base = self.romaji.dup
256
+ kanji.slice!(-1)
257
+ hiragana_word.slice!(-1)
258
+ romaji_conditional_slice(romaji_base)
259
+ self.base = kanji
260
+ self.hiragana_forms[:base] = hiragana_word
261
+ self.romaji_forms[:base] = romaji_base
262
+ end
263
+
264
+ def set_polite_form_conjugations
265
+ polite = Japanese::Conjugator::POLITE_VERB_ENDINGS.values
266
+ romaji_polite = Japanese::Conjugator::ROMAJI_POLITE_VERB_ENDINGS.values
267
+ stem = self.stem_form
268
+ hiragana_stem = self.hiragana_forms[:stem]
269
+ romaji_stem = self.romaji_forms[:stem]
270
+ self.conjugations[:polite_forms] = { present: stem + polite[0],
271
+ past: stem + polite[1],
272
+ present_negative: stem + polite[2],
273
+ past_negative: stem + polite[3],
274
+ volitional: stem + polite[4],
275
+ te_form: stem + polite[5]
276
+ }
277
+ self.hiragana_forms[:polite_forms] = { present: hiragana_stem + polite[0],
278
+ past: hiragana_stem + polite[1],
279
+ present_negative: hiragana_stem + polite[2],
280
+ past_negative: hiragana_stem + polite[3],
281
+ volitional: hiragana_stem + polite[4],
282
+ te_form: hiragana_stem + polite[5]
283
+ }
284
+ self.romaji_forms[:polite_forms] = { past: romaji_stem + romaji_polite[1],
285
+ present: romaji_stem + romaji_polite[0],
286
+ present_negative: romaji_stem + romaji_polite[2],
287
+ past_negative: romaji_stem + romaji_polite[3],
288
+ volitional: romaji_stem + romaji_polite[4],
289
+ te_form: romaji_stem + romaji_polite[5]
290
+ }
291
+ unless self.has_volitional
292
+ self.conjugations[:polite_forms][:volitional] = "N/A"
293
+ self.hiragana_forms[:polite_forms][:volitional] = "N/A"
294
+ self.romaji_forms[:polite_forms][:volitional] = "N/A"
295
+ end
296
+ end
297
+
298
+ def set_negative_plain_forms
299
+ endings = Japanese::Conjugator::NEGATIVE_VERB_ENDINGS.values
300
+ romaji_endings = Japanese::Conjugator::ROMAJI_NEGATIVE_VERB_ENDINGS.values
301
+ stem = self.negative_stem
302
+ hiragana_stem = self.hiragana_forms[:negative_stem]
303
+ romaji_stem = self.romaji_forms[:negative_stem]
304
+ self.conjugations[:negative_plain_forms] = { present: stem + endings[0],
305
+ past: stem + endings[1],
306
+ te_form: stem + endings[2]
307
+ }
308
+ self.hiragana_forms[:negative_plain_forms] = { present: hiragana_stem + endings[0],
309
+ past: hiragana_stem + endings[1],
310
+ te_form: hiragana_stem + endings[2]
311
+ }
312
+ self.romaji_forms[:negative_plain_forms] = { present: romaji_stem + romaji_endings[0],
313
+ past: romaji_stem + romaji_endings[1],
314
+ te_form: romaji_stem + romaji_endings[2]
315
+ }
316
+ end
317
+
318
+ def set_prohibitive_form
319
+ unless self.part_of_speech == "v-aru" || self.part_of_speech == "v5r-i"
320
+ self.conjugations[:prohibitive] = self.kanji + "な"
321
+ self.hiragana_forms[:prohibitive] = self.hiragana + "な"
322
+ self.romaji_forms[:prohibitive] = self.romaji + " na"
323
+ else
324
+ self.conjugations[:prohibitive] = "N/A"
325
+ self.hiragana_forms[:prohibitive] = "N/A"
326
+ self.romaji_forms[:prohibitive] = "N/A"
327
+ end
328
+ end
329
+
330
+ def set_plain_present_potential
331
+ stem = self.base.dup
332
+ hiragana_stem = self.hiragana_forms[:base].dup
333
+ romaji_stem = self.romaji_forms[:base].dup
334
+ case self.part_of_speech
335
+ when "v1"
336
+ stem += "(ら)れ���"
337
+ hiragana_stem += "(ら)れる"
338
+ romaji_stem += "(ra)reru"
339
+ when "v5b"
340
+ stem += "べる"
341
+ hiragana_stem += "べる"
342
+ romaji_stem += "beru"
343
+ when "v5k"
344
+ stem += "ける"
345
+ hiragana_stem += "ける"
346
+ romaji_stem += "keru"
347
+ when "v5k-s"
348
+ stem += "ける"
349
+ hiragana_stem += "ける"
350
+ romaji_stem += "keru"
351
+ when "v5g"
352
+ stem += "げる"
353
+ hiragana_stem += "げる"
354
+ romaji_stem += "geru"
355
+ when "v5m"
356
+ stem += "める"
357
+ hiragana_stem += "める"
358
+ romaji_stem += "meru"
359
+ when "v5n"
360
+ stem += "ねる"
361
+ hiragana_stem += "ねる"
362
+ romaji_stem += "neru"
363
+ when "v5r"
364
+ stem += "れる"
365
+ hiragana_stem += "れる"
366
+ romaji_stem += "reru"
367
+ when "v5r-i"
368
+ stem = "N/A"
369
+ hiragana_stem = "N/A"
370
+ romaji_stem = "N/A"
371
+ when "v5s"
372
+ stem += "せる"
373
+ hiragana_stem += "せる"
374
+ romaji_stem += "seru"
375
+ when "v5t"
376
+ stem += "てる"
377
+ hiragana_stem += "てる"
378
+ romaji_stem += "teru"
379
+ when "v5u"
380
+ stem += "える"
381
+ hiragana_stem += "える"
382
+ romaji_stem += "eru"
383
+ when "v5u-s"
384
+ stem += "える" # Assuming this class is for the irregular 問う, 問い would be the stem
385
+ hiragana_stem += "える"
386
+ romaji_stem += "eru"
387
+ when "v-kuru"
388
+ stem += "れる" # Assuming that you enter "来る" in kanji; this will not work in hiragana.
389
+ hiragana_stem = "これる"
390
+ romaji_stem = "koreru"
391
+ when "v-suru"
392
+ stem = "できる"
393
+ hiragana_stem = "できる"
394
+ romaji_stem = "dekiru"
395
+ when "v-aru"
396
+ stem = "N/A"
397
+ hiragana_stem = "N/A"
398
+ romaji_stem = "N/A"
399
+ end
400
+ self.conjugations[:plain_present_potential] = stem
401
+ self.hiragana_forms[:plain_present_potential] = hiragana_stem
402
+ self.romaji_forms[:plain_present_potential] = romaji_stem
403
+ end
404
+
405
+ def set_conditional
406
+ stem = self.base.dup
407
+ hiragana_stem = self.hiragana_forms[:base].dup
408
+ romaji_stem = self.romaji_forms[:base].dup
409
+ case self.part_of_speech
410
+ when "v1"
411
+ stem += "れば"
412
+ hiragana_stem += "れば"
413
+ romaji_stem += "reba"
414
+ when "v5b"
415
+ stem += "べば"
416
+ hiragana_stem += "べば"
417
+ romaji_stem += "beba"
418
+ when "v5k"
419
+ stem += "けば"
420
+ hiragana_stem += "けば"
421
+ romaji_stem += "keba"
422
+ when "v5k-s"
423
+ stem += "けば"
424
+ hiragana_stem += "けば"
425
+ romaji_stem += "keba"
426
+ when "v5g"
427
+ stem += "げば"
428
+ hiragana_stem += "げば"
429
+ romaji_stem += "geba"
430
+ when "v5m"
431
+ stem += "めば"
432
+ hiragana_stem += "めば"
433
+ romaji_stem += "meba"
434
+ when "v5n"
435
+ stem += "ねば"
436
+ hiragana_stem += "ねば"
437
+ romaji_stem += "neba"
438
+ when "v5r"
439
+ stem += "れば"
440
+ hiragana_stem += "れば"
441
+ romaji_stem += "reba"
442
+ when "v5r-i"
443
+ stem += "れば" # Assuming this class is for いらっしゃる, いらっしゃら would be the stem
444
+ hiragana_stem += "れば"
445
+ romaji_stem += "reba"
446
+ when "v5s"
447
+ stem += "せば"
448
+ hiragana_stem += "せば"
449
+ romaji_stem += "seba"
450
+ when "v5t"
451
+ stem += "てば"
452
+ hiragana_stem += "てば"
453
+ romaji_stem += "teba"
454
+ when "v5u"
455
+ stem += "えば"
456
+ hiragana_stem += "えば"
457
+ romaji_stem += "eba"
458
+ when "v5u-s"
459
+ stem += "えば" # Assuming this class is for the irregular 問う, 問い would be the stem
460
+ hiragana_stem += "えば"
461
+ romaji_stem += "eba"
462
+ when "v-kuru"
463
+ stem += "れば" # Assuming that you enter "来る" in kanji; this will not work in hiragana.
464
+ hiragana_stem = "これば"
465
+ romaji_stem = "koreba"
466
+ when "v-suru"
467
+ stem += "れば"
468
+ hiragana_stem += "れば"
469
+ romaji_stem += "reba"
470
+ when "v-aru"
471
+ stem += "れば"
472
+ hiragana_stem += "れば"
473
+ romaji_stem += "reba"
474
+ end
475
+ self.conjugations[:conditional] = stem
476
+ self.hiragana_forms[:conditional] = hiragana_stem
477
+ self.romaji_forms[:conditional] = romaji_stem
478
+ end
479
+
480
+ def set_te_form
481
+ base = self.base.dup
482
+ hiragana_base = self.hiragana_forms[:base].dup
483
+ romaji_base = self.romaji_forms[:base].dup
484
+ case self.part_of_speech
485
+ when "v1"
486
+ base += "て"
487
+ hiragana_base += "て"
488
+ romaji_base += "te"
489
+ when "v5b"
490
+ base += "んで"
491
+ hiragana_base += "んで"
492
+ romaji_base += "nde"
493
+ when "v5k"
494
+ base += "いて"
495
+ hiragana_base += "いて"
496
+ romaji_base += "ite"
497
+ when "v5k-s"
498
+ base += "って"
499
+ hiragana_base += "って"
500
+ romaji_base += "tte"
501
+ when "v5g"
502
+ base += "いで"
503
+ hiragana_base += "いで"
504
+ romaji_base += "ide"
505
+ when "v5m"
506
+ base += "んで"
507
+ hiragana_base += "んで"
508
+ romaji_base += "nde"
509
+ when "v5n"
510
+ base += "んで"
511
+ hiragana_base += "んで"
512
+ romaji_base += "nde"
513
+ when "v5r"
514
+ base += "って"
515
+ hiragana_base += "って"
516
+ romaji_base += "tte"
517
+ when "v5r-i"
518
+ base += "って" # Assuming this class is for いらっしゃる, いらっしゃって would be the te_form
519
+ hiragana_base += "って"
520
+ romaji_base += "tte"
521
+ when "v5s"
522
+ base += "して"
523
+ hiragana_base += "して"
524
+ romaji_base += "shite"
525
+ when "v5t"
526
+ base += "って"
527
+ hiragana_base += "って"
528
+ romaji_base += "tte"
529
+ when "v5u"
530
+ base += "って"
531
+ hiragana_base += "って"
532
+ romaji_base += "tte"
533
+ when "v5u-s"
534
+ base += "うて" # Assuming this class is for the irregular 問う, 問うて would be the stem
535
+ hiragana_base += "うて"
536
+ romaji_base += "ute"
537
+ when "v-kuru"
538
+ base += "て"
539
+ hiragana_base += "て"
540
+ romaji_base += "te"
541
+ when "v-suru"
542
+ base = "して"
543
+ hiragana_base = "して"
544
+ romaji_base = "shite"
545
+ when "v-aru"
546
+ base += "って"
547
+ hiragana_base += "って"
548
+ romaji_base += "tte"
549
+ end
550
+ self.conjugations[:te_form] = base
551
+ self.hiragana_forms[:te_form] = hiragana_base
552
+ self.romaji_forms[:te_form] = romaji_base
553
+ end
554
+
555
+ def set_ta_form
556
+ base = self.base.dup
557
+ hiragana_base = self.hiragana_forms[:base].dup
558
+ romaji_base = self.romaji_forms[:base].dup
559
+ case self.part_of_speech
560
+ when "v1"
561
+ base += "た"
562
+ hiragana_base += "た"
563
+ romaji_base += "ta"
564
+ when "v5b"
565
+ base += "んだ"
566
+ hiragana_base += "んだ"
567
+ romaji_base += "nda"
568
+ when "v5k"
569
+ base += "いた"
570
+ hiragana_base += "いた"
571
+ romaji_base += "ita"
572
+ when "v5k-s"
573
+ base += "った"
574
+ hiragana_base += "った"
575
+ romaji_base += "tta"
576
+ when "v5g"
577
+ base += "いだ"
578
+ hiragana_base += "いだ"
579
+ romaji_base += "ida"
580
+ when "v5m"
581
+ base += "んだ"
582
+ hiragana_base += "んだ"
583
+ romaji_base += "nda"
584
+ when "v5n"
585
+ base += "んだ"
586
+ hiragana_base += "んだ"
587
+ romaji_base += "nda"
588
+ when "v5r"
589
+ base += "った"
590
+ hiragana_base += "った"
591
+ romaji_base += "tta"
592
+ when "v5r-i"
593
+ base += "った" # Assuming this class is for いらっしゃる, いらっしゃった would be the te_form
594
+ hiragana_base += "った"
595
+ romaji_base += "tta"
596
+ when "v5s"
597
+ base += "した"
598
+ hiragana_base += "した"
599
+ romaji_base += "shita"
600
+ when "v5t"
601
+ base += "った"
602
+ hiragana_base += "った"
603
+ romaji_base += "tta"
604
+ when "v5u"
605
+ base += "った"
606
+ hiragana_base += "った"
607
+ romaji_base += "tta"
608
+ when "v5u-s"
609
+ base += "うた" # Assuming this class is for the irregular 問う, 問うた would be the stem
610
+ hiragana_base += "うた"
611
+ romaji_base += "uta"
612
+ when "v-kuru"
613
+ base += "た"
614
+ hiragana_base += "た"
615
+ romaji_base += "ta"
616
+ when "v-suru"
617
+ base = "した"
618
+ hiragana_base = "した"
619
+ romaji_base = "shita"
620
+ when "v-aru"
621
+ base += "った"
622
+ hiragana_base += "った"
623
+ romaji_base += "tta"
624
+ end
625
+ self.conjugations[:ta_form] = base
626
+ self.hiragana_forms[:ta_form] = hiragana_base
627
+ self.romaji_forms[:ta_form] = romaji_base
628
+ end
629
+
630
+ def set_imperative
631
+ if has_imperative
632
+ base = self.base.dup
633
+ hiragana_base = self.hiragana_forms[:base].dup
634
+ romaji_base = self.romaji_forms[:base].dup
635
+ case self.part_of_speech
636
+ when "v1"
637
+ base += "ろ"
638
+ hiragana_base += "ろ"
639
+ romaji_base += "ro"
640
+ when "v5b"
641
+ base += "べ"
642
+ hiragana_base += "べ"
643
+ romaji_base += "be"
644
+ when "v5k"
645
+ base += "け"
646
+ hiragana_base += "け"
647
+ romaji_base += "ke"
648
+ when "v5k-s"
649
+ base += "け"
650
+ hiragana_base += "け"
651
+ romaji_base += "ke"
652
+ when "v5g"
653
+ base += "げ"
654
+ hiragana_base += "げ"
655
+ romaji_base += "ge"
656
+ when "v5m"
657
+ base += "め"
658
+ hiragana_base += "め"
659
+ romaji_base += "me"
660
+ when "v5n"
661
+ base += "ね"
662
+ hiragana_base += "ね"
663
+ romaji_base += "ne"
664
+ when "v5r"
665
+ base += "れ"
666
+ hiragana_base += "れ"
667
+ romaji_base += "re"
668
+ when "v5r-i"
669
+ base = "N/A"
670
+ hiragana_base = "N/A"
671
+ romaji_base = "N/A"
672
+ when "v5s"
673
+ base += "せ"
674
+ hiragana_base += "せ"
675
+ romaji_base += "se"
676
+ when "v5t"
677
+ base += "て"
678
+ hiragana_base += "て"
679
+ romaji_base += "te"
680
+ when "v5u"
681
+ base += "え"
682
+ hiragana_base += "え"
683
+ romaji_base += "e"
684
+ when "v5u-s"
685
+ base = "N/A"
686
+ hiragana_base = "N/A"
687
+ romaji_base = "N/A"
688
+ when "v-kuru"
689
+ base += "い"
690
+ hiragana_base = "こい"
691
+ romaji_base = "koi"
692
+ when "v-suru"
693
+ base = "しろ"
694
+ hiragana_base = "しろ"
695
+ romaji_base = "shiro"
696
+ when "v-aru"
697
+ base += "れ"
698
+ hiragana_base += "れ"
699
+ romaji_base += "re"
700
+ end
701
+ self.conjugations[:imperative] = base
702
+ self.hiragana_forms[:imperative] = hiragana_base
703
+ self.romaji_forms[:imperative] = romaji_base
704
+ end
705
+ end
706
+
707
+ def set_volitional
708
+ if has_volitional
709
+ base = self.base.dup
710
+ hiragana_base = self.hiragana_forms[:base].dup
711
+ romaji_base = self.romaji_forms[:base].dup
712
+ case self.part_of_speech
713
+ when "v1"
714
+ base += "よう"
715
+ hiragana_base += "よう"
716
+ romaji_base += "yo"
717
+ when "v5b"
718
+ base += "ぼう"
719
+ hiragana_base += "ぼう"
720
+ romaji_base += "bo"
721
+ when "v5k"
722
+ base += "こう"
723
+ hiragana_base += "こう"
724
+ romaji_base += "ko"
725
+ when "v5k-s"
726
+ base += "こう"
727
+ hiragana_base += "こう"
728
+ romaji_base += "ko"
729
+ when "v5g"
730
+ base += "ごう"
731
+ hiragana_base += "ごう"
732
+ romaji_base += "go"
733
+ when "v5m"
734
+ base += "もう"
735
+ hiragana_base += "もう"
736
+ romaji_base += "mo"
737
+ when "v5n"
738
+ base += "のう"
739
+ hiragana_base += "のう"
740
+ romaji_base += "no"
741
+ when "v5r"
742
+ base += "ろう"
743
+ hiragana_base += "ろう"
744
+ romaji_base += "ro"
745
+ when "v5r-i"
746
+ base = "N/A"
747
+ hiragana_base = "N/A"
748
+ romaji_base = "N/A"
749
+ when "v5s"
750
+ base += "そう"
751
+ hiragana_base += "そう"
752
+ romaji_base += "so"
753
+ when "v5t"
754
+ base += "とう"
755
+ hiragana_base += "とう"
756
+ romaji_base += "to"
757
+ when "v5u"
758
+ base += "おう"
759
+ hiragana_base += "おう"
760
+ romaji_base += "o"
761
+ when "v5u-s"
762
+ base = "N/A"
763
+ hiragana_base = "N/A"
764
+ romaji_base = "N/A"
765
+ when "v-kuru"
766
+ base += "よう"
767
+ hiragana_base = "こよう"
768
+ romaji_base = "koyo"
769
+ when "v-suru"
770
+ base = "しよう"
771
+ hiragana_base = "しよう"
772
+ romaji_base = "shiyo"
773
+ when "v-aru"
774
+ base += "ろう"
775
+ hiragana_base += "ろう"
776
+ romaji_base += "ro"
777
+ end
778
+ self.conjugations[:volitional] = base
779
+ self.hiragana_forms[:volitional] = hiragana_base
780
+ self.romaji_forms[:volitional] = romaji_base
781
+ end
782
+ end
783
+
784
+ def set_continuous_forms
785
+ endings = Japanese::Conjugator::CONTINUOUS_ENDINGS.values
786
+ romaji_endings = Japanese::Conjugator::ROMAJI_CONTINUOUS_ENDINGS.values
787
+ te_form = self.conjugations[:te_form]
788
+ hiragana_te_form = self.hiragana_forms[:te_form]
789
+ romaji_te_form = self.romaji_forms[:te_form]
790
+ self.conjugations[:continuous_forms] = { present_spoken: te_form + endings[0],
791
+ present_written: te_form + endings[1],
792
+ present_polite: te_form + endings[2],
793
+ present_polite_spoken: te_form + endings[3],
794
+ past_spoken: te_form + endings[4],
795
+ past_written: te_form + endings[5],
796
+ past_polite: te_form + endings[6],
797
+ past_polite_spoken: te_form + endings[7],
798
+ te_form_spoken: te_form + endings[8],
799
+ te_form_written: te_form + endings[9],
800
+ te_form_polite: te_form + endings[10],
801
+ te_form_polite_spoken: te_form + endings[11],
802
+ negative_te_form_spoken: te_form + endings[12],
803
+ negative_te_form_written: te_form + endings[13]
804
+ }
805
+ self.hiragana_forms[:continuous_forms] = { present_spoken: hiragana_te_form + endings[0],
806
+ present_written: hiragana_te_form + endings[1],
807
+ present_polite: hiragana_te_form + endings[2],
808
+ present_polite_spoken: hiragana_te_form + endings[3],
809
+ past_spoken: hiragana_te_form + endings[4],
810
+ past_written: hiragana_te_form + endings[5],
811
+ past_polite: hiragana_te_form + endings[6],
812
+ past_polite_spoken: hiragana_te_form + endings[7],
813
+ te_form_spoken: hiragana_te_form + endings[8],
814
+ te_form_written: hiragana_te_form + endings[9],
815
+ te_form_polite: hiragana_te_form + endings[10],
816
+ te_form_polite_spoken: hiragana_te_form + endings[11],
817
+ negative_te_form_spoken: hiragana_te_form + endings[12],
818
+ negative_te_form_written: hiragana_te_form + endings[13]
819
+ }
820
+ self.romaji_forms[:continuous_forms] = { present_spoken: romaji_te_form + romaji_endings[0],
821
+ present_written: romaji_te_form + romaji_endings[1],
822
+ present_polite: romaji_te_form + romaji_endings[2],
823
+ present_polite_spoken: romaji_te_form + romaji_endings[3],
824
+ past_spoken: romaji_te_form + romaji_endings[4],
825
+ past_written: romaji_te_form + romaji_endings[5],
826
+ past_polite: romaji_te_form + romaji_endings[6],
827
+ past_polite_spoken: romaji_te_form + romaji_endings[7],
828
+ te_form_spoken: romaji_te_form + romaji_endings[8],
829
+ te_form_written: romaji_te_form + romaji_endings[9],
830
+ te_form_polite: romaji_te_form + romaji_endings[10],
831
+ te_form_polite_spoken: romaji_te_form + romaji_endings[11],
832
+ negative_te_form_spoken: romaji_te_form + romaji_endings[12],
833
+ negative_te_form_written: romaji_te_form + romaji_endings[13]
834
+ }
835
+ end
836
+
837
+ def process_i_adjective
838
+ set_adjective_base
839
+ set_adjective_adverbial_form
840
+ set_negative_adjective_forms
841
+ set_adjective_conjugations
842
+ end
843
+
844
+ def set_adjective_base
845
+ if self.part_of_speech == "adj-i"
846
+ base = self.kanji.dup
847
+ base.slice!(-1)
848
+ hiragana_base = self.hiragana.dup
849
+ hiragana_base.slice!(-1)
850
+ romaji_base = self.romaji.dup
851
+ romaji_base.slice!(-1)
852
+ end
853
+ self.conjugations[:adjective_base] = base
854
+ self.hiragana_forms[:adjective_base] = hiragana_base
855
+ self.romaji_forms[:adjective_base] = romaji_base
856
+ end
857
+
858
+ def set_adjective_adverbial_form
859
+ self.conjugations[:adverbial_form] = self.conjugations[:adjective_base] + "く"
860
+ self.hiragana_forms[:adverbial_form] = self.hiragana_forms[:adjective_base] + "く"
861
+ self.romaji_forms[:adverbial_form] = self.romaji_forms[:adjective_base] + "ku"
862
+ end
863
+
864
+ def set_negative_adjective_forms
865
+ neg = self.conjugations[:adverbial_form]
866
+ hiragana_neg = self.hiragana_forms[:adverbial_form]
867
+ romaji_neg = self.romaji_forms[:adverbial_form]
868
+ self.conjugations[:negative_adjective_forms] = { present: neg + "ない",
869
+ present_polite: neg + "ありません",
870
+ past: neg + "なかった",
871
+ past_polite: neg + "ありませんでした",
872
+ te_form: neg + "なくて",
873
+ present_honorofic: neg + "ございません",
874
+ past_honorific: neg + "ございませんでした",
875
+ te_form_honorific: neg + "ございませんでして"
876
+ }
877
+ self.hiragana_forms[:negative_adjective_forms] = { present: hiragana_neg + "ない",
878
+ present_polite: hiragana_neg + "ありません",
879
+ past: hiragana_neg + "なかった",
880
+ past_polite: hiragana_neg + "ありませんでした",
881
+ te_form: hiragana_neg + "なくて",
882
+ present_honorific: hiragana_neg + "ございません",
883
+ past_honorific: hiragana_neg + "ございませんでした",
884
+ te_form_honorific: hiragana_neg + "ございませんでして"
885
+ }
886
+ self.romaji_forms[:negative_adjective_forms] = { present: romaji_neg + " nai",
887
+ present_polite: romaji_neg + " arimasen",
888
+ past_polite: romaji_neg + " arimasen deshita",
889
+ past: romaji_neg + " nakatta",
890
+ te_form: romaji_neg + " nakute",
891
+ present_honorific: romaji_neg + " gozaimasen",
892
+ pasts_honorific: romaji_neg + " gozaimasen deshita",
893
+ te_form_honorific: " gozaimasen deshite"
894
+ }
895
+ end
896
+
897
+ def set_adjective_conjugations
898
+ stem = self.conjugations[:adjective_base]
899
+ hiragana_stem = self.hiragana_forms[:adjective_base]
900
+ romaji_stem = self.romaji_forms[:adjective_base]
901
+ self.conjugations[:adjective_conjugations] = { present: self.kanji,
902
+ present_polite: self.kanji + "です",
903
+ past: stem + "かった",
904
+ past_polite: self.kanji + "でした",
905
+ te_form: stem + "くて"
906
+ }
907
+ self.hiragana_forms[:adjective_conjugations] = { present: self.hiragana,
908
+ present_polite: self.hiragana + "です",
909
+ past: hiragana_stem + "かった",
910
+ past_polite: self.hiragana + "でした",
911
+ te_form: hiragana_stem + "くて"
912
+ }
913
+ self.romaji_forms[:adjective_conjugations] = { present: self.romaji,
914
+ present_polite: self.romaji + " desu",
915
+ past: romaji_stem + "katta",
916
+ past_polite: self.romaji + " deshita",
917
+ te_form: romaji_stem + "kute"
918
+ }
919
+ end
920
+
921
+ def set_copula_conjugations
922
+ self.conjugations[:copula] = { present: "だ",
923
+ present_polite: "です",
924
+ present_formal: "である",
925
+ present_honorific: "でございます",
926
+ past: "だった",
927
+ past_polite: "でした",
928
+ past_formal: "であった",
929
+ past_honorific: "でございました",
930
+ volitional: "だろう",
931
+ volitional_polite: "でしょう",
932
+ volitional_formal: "であろう",
933
+ volitional_honorific: "でございましょう",
934
+ te_form: "で",
935
+ te_form_polite: "でして",
936
+ te_form_formal: "であって",
937
+ te_form_honorific: "でございまして",
938
+ continuous_formal: "であり"
939
+ }
940
+ self.hiragana_forms[:copula] = self.conjugations[:copula]
941
+ self.romaji_forms[:copula] = { present: "da",
942
+ present_polite: "desu",
943
+ present_formal: "de aru",
944
+ present_honorific: "de gozaimasu",
945
+ past: "datta",
946
+ past_polite: "deshita",
947
+ past_formal: "de atta",
948
+ past_honorific: "de gozaimashita",
949
+ volitional: "daro",
950
+ volitional_polite: "desho",
951
+ volitional_formal: "de aro",
952
+ volitional_honorific: "de gozaimasho",
953
+ te_form: "de",
954
+ te_form_polite: "deshite",
955
+ te_form_formal: "de atte",
956
+ te_form_honorific: "de gozaimashite",
957
+ continuous_formal: "de ari"
958
+ }
959
+ end
960
+
961
+
962
+ def set_passive_dictionary_form
963
+ if self.has_passive
964
+ if self.part_of_speech == "v1"
965
+ stem = self.stem_form
966
+ hiragana_stem = self.hiragana_forms[:stem]
967
+ romaji_stem = self.romaji_forms[:stem]
968
+ elsif self.part_of_speech == "v-suru"
969
+ stem = "され"
970
+ hiragana_stem = "され"
971
+ romaji_stem = "sare"
972
+ else
973
+ stem = self.negative_stem
974
+ hiragana_stem = self.hiragana_forms[:negative_stem]
975
+ romaji_stem = self.romaji_forms[:negative_stem]
976
+ end
977
+ case self.part_of_speech
978
+ when "v1"
979
+ passive = stem += "られる"
980
+ hiragana_passive = hiragana_stem += "られる"
981
+ romaji_passive = romaji_stem += "rareru"
982
+ when "v-suru"
983
+ passive = stem += "る"
984
+ hiragana_passive = hiragana_stem += "る"
985
+ romaji_passive = romaji_stem += "ru"
986
+ else
987
+ passive = stem += "れる"
988
+ hiragana_passive = hiragana_stem += "れる"
989
+ romaji_passive = romaji_stem += "reru"
990
+ end
991
+ self.passive_dictionary_form = passive
992
+ self.hiragana_forms[:passive_dictionary_form] = hiragana_passive
993
+ self.romaji_forms[:passive_dictionary_form] = romaji_passive
994
+ end
995
+ end
996
+
997
+ def set_passive_forms_hash
998
+ if self.has_passive
999
+ set_passive_stem
1000
+ set_passive_polite_forms
1001
+ set_passive_negative_plain_forms
1002
+ set_passive_te_and_ta_forms
1003
+ set_passive_continuous_forms
1004
+ set_passive_conditional
1005
+ end
1006
+ end
1007
+
1008
+ def set_passive_stem
1009
+ stem = self.passive_dictionary_form.dup
1010
+ stem.slice!(-1)
1011
+ hiragana_stem = self.hiragana_forms[:passive_dictionary_form].dup
1012
+ hiragana_stem.slice!(-1)
1013
+ romaji_stem = self.romaji_forms[:passive_dictionary_form].dup
1014
+ romaji_stem.slice!(-2..-1)
1015
+ self.passive_forms[:stem] = stem
1016
+ self.passive_forms_hiragana[:stem] = hiragana_stem
1017
+ self.passive_forms_romaji[:stem] = romaji_stem
1018
+ end
1019
+
1020
+ def set_passive_polite_forms
1021
+ stem = self.passive_forms[:stem]
1022
+ hiragana_stem = self.passive_forms_hiragana[:stem]
1023
+ romaji_stem = self.passive_forms_romaji[:stem]
1024
+ polite = Japanese::Conjugator::POLITE_VERB_ENDINGS.values
1025
+ romaji_polite = Japanese::Conjugator::ROMAJI_POLITE_VERB_ENDINGS.values
1026
+ self.passive_forms[:polite_forms] = { present: stem + polite[0],
1027
+ past: stem + polite[1],
1028
+ present_negative: stem + polite[2],
1029
+ past_negative: stem + polite[3],
1030
+ te_form: stem + polite[5]
1031
+ }
1032
+ self.passive_forms_hiragana[:polite_forms] = {
1033
+ present: hiragana_stem + polite[0],
1034
+ past: hiragana_stem + polite[1],
1035
+ present_negative: hiragana_stem + polite[2],
1036
+ past_negative: hiragana_stem + polite[3],
1037
+ te_form: hiragana_stem + polite[5]
1038
+ }
1039
+ self.passive_forms_romaji[:polite_forms] = { present: romaji_stem + romaji_polite[0],
1040
+ past: romaji_stem + romaji_polite[1],
1041
+ present_negative: romaji_stem + romaji_polite[2],
1042
+ past_negative: romaji_stem + romaji_polite[3],
1043
+ te_form: romaji_stem + romaji_polite[5]
1044
+ }
1045
+ end
1046
+
1047
+ def set_passive_negative_plain_forms
1048
+ stem = self.passive_forms[:stem]
1049
+ hiragana_stem = self.passive_forms_hiragana[:stem]
1050
+ romaji_stem = self.passive_forms_romaji[:stem]
1051
+ endings = Japanese::Conjugator::NEGATIVE_VERB_ENDINGS.values
1052
+ romaji_endings = Japanese::Conjugator::ROMAJI_NEGATIVE_VERB_ENDINGS.values
1053
+ self.passive_forms[:negative_plain_forms] = { present: stem + endings[0],
1054
+ past: stem + endings[1],
1055
+ te_form: stem + endings[2]
1056
+ }
1057
+ self.passive_forms_hiragana[:negative_plain_forms] = {
1058
+ present: hiragana_stem + endings[0],
1059
+ past: hiragana_stem + endings[1],
1060
+ te_form: hiragana_stem + endings[2]
1061
+ }
1062
+ self.passive_forms_romaji[:negative_plain_forms] = { present: romaji_stem + romaji_endings[0],
1063
+ past: romaji_stem + romaji_endings[1],
1064
+ te_form: romaji_stem + romaji_endings[2]
1065
+ }
1066
+ end
1067
+
1068
+ def set_passive_te_and_ta_forms
1069
+ stem = self.passive_forms[:stem]
1070
+ hiragana_stem = self.passive_forms_hiragana[:stem]
1071
+ romaji_stem = self.passive_forms_romaji[:stem]
1072
+ self.passive_forms[:te_form] = stem + "て"
1073
+ self.passive_forms[:ta_form] = stem + "た"
1074
+ self.passive_forms_hiragana[:te_form] = hiragana_stem + "て"
1075
+ self.passive_forms_hiragana[:ta_form] = hiragana_stem + "た"
1076
+ self.passive_forms_romaji[:te_form] = romaji_stem + "te"
1077
+ self.passive_forms_romaji[:ta_form] = romaji_stem + "ta"
1078
+ end
1079
+
1080
+ def set_passive_continuous_forms
1081
+ te_form = self.passive_forms[:te_form]
1082
+ hiragana_te_form = self.passive_forms_hiragana[:te_form]
1083
+ romaji_te_form = self.passive_forms_romaji[:te_form]
1084
+ endings = Japanese::Conjugator::CONTINUOUS_ENDINGS.values
1085
+ romaji_endings = Japanese::Conjugator::ROMAJI_CONTINUOUS_ENDINGS.values
1086
+ self.passive_forms[:continuous_forms] = { present_spoken: te_form + endings[0],
1087
+ present_written: te_form + endings[1],
1088
+ present_formal: te_form + endings[2],
1089
+ present_formal_spoken: te_form + endings[3],
1090
+ past_spoken: te_form + endings[4],
1091
+ past_written: te_form + endings[5],
1092
+ past_formal: te_form + endings[6],
1093
+ past_polite_spoken: te_form + endings[7],
1094
+ te_form_spoken: te_form + endings[8],
1095
+ te_form_written: te_form + endings[9],
1096
+ te_form_polite: te_form + endings[10],
1097
+ te_form_polite_spoken: te_form + endings[11],
1098
+ negative_te_form_spoken: te_form + endings[12],
1099
+ negative_te_form_written: te_form + endings[13]
1100
+ }
1101
+ self.passive_forms_hiragana[:continuous_forms] = { present_spoken: hiragana_te_form + endings[0],
1102
+ present_written: hiragana_te_form + endings[1],
1103
+ present_formal: hiragana_te_form + endings[2],
1104
+ present_formal_spoken: hiragana_te_form + endings[3],
1105
+ past_spoken: hiragana_te_form + endings[4],
1106
+ past_written: hiragana_te_form + endings[5],
1107
+ past_formal: hiragana_te_form + endings[6],
1108
+ past_polite_spoken: hiragana_te_form + endings[7],
1109
+ te_form_spoken: hiragana_te_form + endings[8],
1110
+ te_form_written: hiragana_te_form + endings[9],
1111
+ te_form_polite: hiragana_te_form + endings[10],
1112
+ te_form_polite_spoken: hiragana_te_form + endings[11],
1113
+ negative_te_form_spoken: hiragana_te_form + endings[12],
1114
+ negative_te_form_written: hiragana_te_form + endings[13]
1115
+ }
1116
+ self.passive_forms_romaji[:continuous_forms] = { present_spoken: romaji_te_form + romaji_endings[0],
1117
+ present_written: romaji_te_form + romaji_endings[1],
1118
+ present_formal: romaji_te_form + romaji_endings[2],
1119
+ present_formal_spoken: romaji_te_form + romaji_endings[3],
1120
+ past_spoken: romaji_te_form + romaji_endings[4],
1121
+ past_written: romaji_te_form + romaji_endings[5],
1122
+ past_formal: romaji_te_form + romaji_endings[6],
1123
+ past_polite_spoken: romaji_te_form + romaji_endings[7],
1124
+ te_form_spoken: romaji_te_form + romaji_endings[8],
1125
+ te_form_written: romaji_te_form + romaji_endings[9],
1126
+ te_form_polite: romaji_te_form + romaji_endings[10],
1127
+ te_form_polite_spoken: romaji_te_form + romaji_endings[11],
1128
+ negative_te_form_spoken: romaji_te_form + romaji_endings[12],
1129
+ negative_te_form_written: romaji_te_form + romaji_endings[13]
1130
+ }
1131
+ end
1132
+
1133
+ def set_passive_conditional
1134
+ stem = self.passive_forms[:stem]
1135
+ hiragana_stem = self.passive_forms_hiragana[:stem]
1136
+ romaji_stem = self.passive_forms_romaji[:stem]
1137
+ self.passive_forms[:conditional] = stem + "ば"
1138
+ self.passive_forms_hiragana[:conditional] = hiragana_stem + "ば"
1139
+ self.passive_forms_romaji[:conditional] = romaji_stem + "ba"
1140
+ end
1141
+
1142
+ def set_causative_dictionary_form
1143
+ if self.has_causative
1144
+ if self.part_of_speech == "v1"
1145
+ stem = self.stem_form
1146
+ hiragana_stem = self.hiragana_forms[:stem]
1147
+ romaji_stem = self.romaji_forms[:stem]
1148
+ elsif self.part_of_speech == "v-suru"
1149
+ stem = "させ"
1150
+ hiragana_stem = "させ"
1151
+ romaji_stem = "sase"
1152
+ else
1153
+ stem = self.negative_stem
1154
+ hiragana_stem = self.hiragana_forms[:negative_stem]
1155
+ romaji_stem = self.romaji_forms[:negative_stem]
1156
+ end
1157
+ case self.part_of_speech
1158
+ when "v1"
1159
+ causative = stem += "させる"
1160
+ hiragana_causative = hiragana_stem += "させる"
1161
+ romaji_causative = romaji_stem += "saseru"
1162
+ when "v-suru"
1163
+ causative = stem += "る"
1164
+ hiragana_causative = hiragana_stem += "る"
1165
+ romaji_causative = romaji_stem += "ru"
1166
+ else
1167
+ causative = stem += "せる"
1168
+ hiragana_causative = hiragana_stem += "せる"
1169
+ romaji_causative = romaji_stem += "seru"
1170
+ end
1171
+ self.causative_dictionary_form = causative
1172
+ self.hiragana_forms[:causative_dictionary_form] = hiragana_causative
1173
+ self.romaji_forms[:causative_dictionary_form] = romaji_causative
1174
+ end
1175
+ end
1176
+
1177
+ def set_causative_stem
1178
+ stem = self.causative_dictionary_form.dup
1179
+ stem.slice!(-1)
1180
+ hiragana_stem = self.hiragana_forms[:causative_dictionary_form].dup
1181
+ hiragana_stem.slice!(-1)
1182
+ romaji_stem = self.romaji_forms[:causative_dictionary_form].dup
1183
+ romaji_stem.slice!(-2..-1)
1184
+ self.causative_forms[:stem] = stem
1185
+ self.causative_forms_hiragana[:stem] = hiragana_stem
1186
+ self.causative_forms_romaji[:stem] = romaji_stem
1187
+ end
1188
+
1189
+ def set_causative_forms_hash
1190
+ if self.has_causative
1191
+ set_causative_stem
1192
+ set_causative_te_and_ta_forms
1193
+ set_causative_polite_forms
1194
+ set_causative_negative_plain_forms
1195
+ set_causative_continuous_forms
1196
+ set_causative_prohibitive_form
1197
+ set_causative_conditional
1198
+ set_causative_imperative
1199
+ set_causative_volitional
1200
+ end
1201
+ end
1202
+
1203
+ def set_causative_te_and_ta_forms
1204
+ stem = self.causative_forms[:stem]
1205
+ hiragana_stem = self.causative_forms_hiragana[:stem]
1206
+ romaji_stem = self.causative_forms_romaji[:stem]
1207
+ self.causative_forms[:te_form] = stem + "て"
1208
+ self.causative_forms[:ta_form] = stem + "た"
1209
+ self.causative_forms_hiragana[:te_form] = hiragana_stem + "て"
1210
+ self.causative_forms_hiragana[:ta_form] = hiragana_stem + "た"
1211
+ self.causative_forms_romaji[:te_form] = romaji_stem + "te"
1212
+ self.causative_forms_romaji[:ta_form] = romaji_stem + "ta"
1213
+ end
1214
+
1215
+ def set_causative_polite_forms
1216
+ polite = Japanese::Conjugator::POLITE_VERB_ENDINGS.values
1217
+ romaji_polite = Japanese::Conjugator::ROMAJI_POLITE_VERB_ENDINGS.values
1218
+ stem = self.causative_forms[:stem]
1219
+ hiragana_stem = self.causative_forms_hiragana[:stem]
1220
+ romaji_stem = self.causative_forms_romaji[:stem]
1221
+ self.causative_forms[:polite_forms] = { present: stem + polite[0],
1222
+ past: stem + polite[1],
1223
+ present_negative: stem + polite[2],
1224
+ past_negative: stem + polite[3],
1225
+ volitional: stem + polite[4],
1226
+ te_form: stem + polite[5]
1227
+ }
1228
+
1229
+ self.causative_forms_hiragana[:polite_forms] = { present: hiragana_stem + polite[0],
1230
+ past: hiragana_stem + polite[1],
1231
+ present_negative: hiragana_stem + polite[2],
1232
+ past_negative: hiragana_stem + polite[3],
1233
+ volitional: hiragana_stem + polite[4],
1234
+ te_form: hiragana_stem + polite[5]
1235
+ }
1236
+ self.causative_forms_romaji[:polite_forms] = { present: romaji_stem + romaji_polite[0],
1237
+ past: romaji_stem + romaji_polite[1],
1238
+ present_negative: romaji_stem + romaji_polite[2],
1239
+ past_negative: romaji_stem + romaji_polite[3],
1240
+ volitional: romaji_stem + romaji_polite[4],
1241
+ te_form: romaji_stem + romaji_polite[5]
1242
+ }
1243
+ end
1244
+
1245
+ def set_causative_negative_plain_forms
1246
+ endings = Japanese::Conjugator::NEGATIVE_VERB_ENDINGS.values
1247
+ romaji_endings = Japanese::Conjugator::ROMAJI_NEGATIVE_VERB_ENDINGS.values
1248
+ stem = self.causative_forms[:stem]
1249
+ hiragana_stem = self.causative_forms_hiragana[:stem]
1250
+ romaji_stem = self.causative_forms_romaji[:stem]
1251
+ self.causative_forms[:negative_plain_forms] = { present: stem + endings[0],
1252
+ past: stem + endings[1],
1253
+ te_form: stem + endings[2]
1254
+ }
1255
+
1256
+ self.causative_forms_hiragana[:negative_plain_forms] = { present: hiragana_stem + endings[0],
1257
+ past: hiragana_stem + endings[1],
1258
+ te_form: hiragana_stem + endings[2]
1259
+ }
1260
+ self.causative_forms_romaji[:negative_plain_forms] = { present: romaji_stem + romaji_endings[0],
1261
+ past: romaji_stem + romaji_endings[1],
1262
+ te_form: romaji_stem + romaji_endings[2]
1263
+ }
1264
+ end
1265
+
1266
+ def set_causative_continuous_forms
1267
+ endings = Japanese::Conjugator::CONTINUOUS_ENDINGS.values
1268
+ romaji_endings = Japanese::Conjugator::ROMAJI_CONTINUOUS_ENDINGS.values
1269
+ te_form = self.causative_forms[:te_form]
1270
+ hiragana_te_form = self.causative_forms_hiragana[:te_form]
1271
+ romaji_te_form = self.causative_forms_romaji[:te_form]
1272
+ self.causative_forms[:continuous_forms] = { present_spoken: te_form + endings[0],
1273
+ present_written: te_form + endings[1],
1274
+ present_formal: te_form + endings[2],
1275
+ present_formal_spoken: te_form + endings[3],
1276
+ past_spoken: te_form + endings[4],
1277
+ past_written: te_form + endings[5],
1278
+ past_formal: te_form + endings[6],
1279
+ past_polite_spoken: te_form + endings[7],
1280
+ te_form_spoken: te_form + endings[8],
1281
+ te_form_written: te_form + endings[9],
1282
+ te_form_polite: te_form + endings[10],
1283
+ te_form_polite_spoken: te_form + endings[11],
1284
+ negative_te_form_spoken: te_form + endings[12],
1285
+ negative_te_form_written: te_form + endings[13]
1286
+ }
1287
+
1288
+ self.causative_forms_hiragana[:continuous_forms] = { present_spoken: hiragana_te_form + endings[0],
1289
+ present_written: hiragana_te_form + endings[1],
1290
+ present_formal: hiragana_te_form + endings[2],
1291
+ present_formal_spoken: hiragana_te_form + endings[3],
1292
+ past_spoken: hiragana_te_form + endings[4],
1293
+ past_written: hiragana_te_form + endings[5],
1294
+ past_formal: hiragana_te_form + endings[6],
1295
+ past_polite_spoken: hiragana_te_form + endings[7],
1296
+ te_form_spoken: hiragana_te_form + endings[8],
1297
+ te_form_written: hiragana_te_form + endings[9],
1298
+ te_form_polite: hiragana_te_form + endings[10],
1299
+ te_form_polite_spoken: hiragana_te_form + endings[11],
1300
+ negative_te_form_spoken: hiragana_te_form + endings[12],
1301
+ negative_te_form_written: hiragana_te_form + endings[13]
1302
+ }
1303
+ self.causative_forms_romaji[:continuous_forms] = { present_spoken: romaji_te_form + romaji_endings[0],
1304
+ present_written: romaji_te_form + romaji_endings[1],
1305
+ present_formal: romaji_te_form + romaji_endings[2],
1306
+ present_formal_spoken: romaji_te_form + romaji_endings[3],
1307
+ past_spoken: romaji_te_form + romaji_endings[4],
1308
+ past_written: romaji_te_form + romaji_endings[5],
1309
+ past_formal: romaji_te_form + romaji_endings[6],
1310
+ past_polite_spoken: romaji_te_form + romaji_endings[7],
1311
+ te_form_spoken: romaji_te_form + romaji_endings[8],
1312
+ te_form_written: romaji_te_form + romaji_endings[9],
1313
+ te_form_polite: romaji_te_form + romaji_endings[10],
1314
+ te_form_polite_spoken: romaji_te_form + romaji_endings[11],
1315
+ negative_te_form_spoken: romaji_te_form + romaji_endings[12],
1316
+ negative_te_form_written: romaji_te_form + romaji_endings[13]
1317
+ }
1318
+ end
1319
+
1320
+ def set_causative_prohibitive_form
1321
+ self.causative_forms[:prohibitive] = self.causative_dictionary_form + "な"
1322
+ self.causative_forms_hiragana[:prohibitive] = self.hiragana_forms[:causative_dictionary_form] + "な"
1323
+ self.causative_forms_romaji[:prohibitive] = self.romaji_forms[:causative_dictionary_form] + " na"
1324
+ end
1325
+
1326
+
1327
+ def set_causative_conditional
1328
+ self.causative_forms[:conditional] = self.causative_forms[:stem] + "ば"
1329
+ self.causative_forms_hiragana[:conditional] = self.causative_forms_hiragana[:stem] + "ば"
1330
+ self.causative_forms_romaji[:conditional] = self.causative_forms_romaji[:stem] + "ba"
1331
+ end
1332
+
1333
+ def set_causative_imperative
1334
+ self.causative_forms[:imperative] = self.causative_forms[:stem] + "ろ"
1335
+ self.causative_forms_hiragana[:imperative] = self.causative_forms_hiragana[:stem] + "ろ"
1336
+ self.causative_forms_romaji[:imperative] = self.causative_forms_romaji[:stem] + "ro"
1337
+ end
1338
+
1339
+ def set_causative_volitional
1340
+ self.causative_forms[:volitional] = self.causative_forms[:stem] + "よう"
1341
+ self.causative_forms_hiragana[:volitional] = self.causative_forms_hiragana[:stem] + "よう"
1342
+ self.causative_forms_romaji[:volitional] = self.causative_forms_romaji[:stem] + "yo"
1343
+ end
1344
+
1345
+ def set_causative_passive_dictionary_form
1346
+ if has_causative_passive
1347
+ unless part_of_speech.in?(%w(v5k v5k-s v5b v5g v5m v5n v5r v5s v5t v5u v5u-s)) # Because only vowel verbs will conjugate properly from the causative stem
1348
+ stem = self.causative_forms[:stem]
1349
+ hiragana_stem = self.causative_forms_hiragana[:stem]
1350
+ romaji_stem = self.causative_forms_romaji[:stem]
1351
+ self.causative_passive_dictionary_form = stem + "られる"
1352
+ self.hiragana_forms[:causative_passive_dictionary_form] = hiragana_stem + "られる"
1353
+ self.romaji_forms[:causative_passive_dictionary_form] = romaji_stem + "rareru"
1354
+ else
1355
+ unless part_of_speech == "v5s" # This handles all consonant regular verbs except v5s class verbs
1356
+ stem = self.negative_stem
1357
+ hiragana_stem = self.hiragana_forms[:negative_stem]
1358
+ romaji_stem = self.romaji_forms[:negative_stem]
1359
+ self.causative_passive_dictionary_form = stem + "される"
1360
+ self.hiragana_forms[:causative_passive_dictionary_form] = hiragana_stem + "される"
1361
+ self.romaji_forms[:causative_passive_dictionary_form] = romaji_stem + "sareru"
1362
+ else # This chunk handles v5s class verbs
1363
+ stem = self.negative_stem
1364
+ hiragana_stem = self.hiragana_forms[:negative_stem]
1365
+ romaji_stem = self.romaji_forms[:negative_stem]
1366
+ self.causative_passive_dictionary_form = stem + "れる"
1367
+ self.hiragana_forms[:causative_passive_dictionary_form] = hiragana_stem + "れる"
1368
+ self.romaji_forms[:causative_passive_dictionary_form] = romaji_stem + "reru"
1369
+ end
1370
+ end
1371
+ end
1372
+ end
1373
+
1374
+ def set_causative_passive_stem
1375
+ stem = self.causative_passive_dictionary_form.dup
1376
+ stem.slice!(-1)
1377
+ hiragana_stem = self.hiragana_forms[:causative_passive_dictionary_form].dup
1378
+ hiragana_stem.slice!(-1)
1379
+ romaji_stem = self.romaji_forms[:causative_passive_dictionary_form].dup
1380
+ romaji_stem.slice!(-2..-1)
1381
+ self.causative_passive_forms[:stem] = stem
1382
+ self.causative_passive_forms_hiragana[:stem] = hiragana_stem
1383
+ self.causative_passive_forms_romaji[:stem] = romaji_stem
1384
+ end
1385
+
1386
+ def set_causative_passive_forms_hash
1387
+ if self.has_causative_passive
1388
+ set_causative_passive_stem
1389
+ set_causative_passive_te_and_ta_forms
1390
+ set_causative_passive_polite_forms
1391
+ set_causative_passive_negative_plain_forms
1392
+ set_causative_passive_continuous_forms
1393
+ set_causative_passive_conditional
1394
+ end
1395
+ end
1396
+
1397
+
1398
+ def set_causative_passive_polite_forms
1399
+ stem = self.causative_passive_forms[:stem]
1400
+ hiragana_stem = self.causative_passive_forms_hiragana[:stem]
1401
+ romaji_stem = self.causative_passive_forms_romaji[:stem]
1402
+ romaji_polite = Japanese::Conjugator::ROMAJI_POLITE_VERB_ENDINGS.values
1403
+ polite = Japanese::Conjugator::POLITE_VERB_ENDINGS.values
1404
+ self.causative_passive_forms[:polite_forms] = { present: stem + polite[0],
1405
+ past: stem + polite[1],
1406
+ present_negative: stem + polite[2],
1407
+ past_negative: stem + polite[3],
1408
+ te_form: stem + polite[5]
1409
+ }
1410
+
1411
+ self.causative_passive_forms_hiragana[:polite_forms] = { present: hiragana_stem + polite[0],
1412
+ past: hiragana_stem + polite[1],
1413
+ present_negative: hiragana_stem + polite[2],
1414
+ past_negative: hiragana_stem + polite[3],
1415
+ te_form: hiragana_stem + polite[5]
1416
+ }
1417
+ self.causative_passive_forms_romaji[:polite_forms] = { present: romaji_stem + romaji_polite[0],
1418
+ past: romaji_stem + romaji_polite[1],
1419
+ present_negative: romaji_stem + romaji_polite[2],
1420
+ past_negative: romaji_stem + romaji_polite[3],
1421
+ te_form: romaji_stem + romaji_polite[5]
1422
+ }
1423
+ end
1424
+
1425
+ def set_causative_passive_negative_plain_forms
1426
+ stem = self.causative_passive_forms[:stem]
1427
+ hiragana_stem = self.causative_passive_forms_hiragana[:stem]
1428
+ romaji_stem = self.causative_passive_forms_romaji[:stem]
1429
+ endings = Japanese::Conjugator::NEGATIVE_VERB_ENDINGS.values
1430
+ romaji_endings = Japanese::Conjugator::ROMAJI_NEGATIVE_VERB_ENDINGS.values
1431
+ self.causative_passive_forms[:negative_plain_forms] = { present: stem + endings[0],
1432
+ past: stem + endings[1],
1433
+ te_form: stem + endings[2]
1434
+ }
1435
+
1436
+ self.causative_passive_forms_hiragana[:negative_plain_forms] = { present: hiragana_stem + endings[0],
1437
+ past: hiragana_stem + endings[1],
1438
+ te_form: hiragana_stem + endings[2]
1439
+ }
1440
+ self.causative_passive_forms_romaji[:negative_plain_forms] = { present: romaji_stem + romaji_endings[0],
1441
+ past: romaji_stem + romaji_endings[1],
1442
+ te_form: romaji_stem + romaji_endings[2]
1443
+ }
1444
+ end
1445
+
1446
+ def set_causative_passive_te_and_ta_forms
1447
+ stem = self.causative_passive_forms[:stem]
1448
+ hiragana_stem = self.causative_passive_forms_hiragana[:stem]
1449
+ romaji_stem = self.causative_passive_forms_romaji[:stem]
1450
+ self.causative_passive_forms[:te_form] = stem + "て"
1451
+ self.causative_passive_forms[:ta_form] = stem + "た"
1452
+ self.causative_passive_forms_hiragana[:te_form] = hiragana_stem + "て"
1453
+ self.causative_passive_forms_hiragana[:ta_form] = hiragana_stem + "た"
1454
+ self.causative_passive_forms_romaji[:te_form] = romaji_stem + "te"
1455
+ self.causative_passive_forms_romaji[:ta_form] = romaji_stem + "ta"
1456
+ end
1457
+
1458
+ def set_causative_passive_continuous_forms
1459
+ te_form = self.causative_passive_forms[:te_form]
1460
+ hiragana_te_form = self.causative_passive_forms_hiragana[:te_form]
1461
+ romaji_te_form = self.causative_passive_forms_romaji[:te_form]
1462
+ endings = Japanese::Conjugator::CONTINUOUS_ENDINGS.values
1463
+ romaji_endings = Japanese::Conjugator::ROMAJI_CONTINUOUS_ENDINGS.values
1464
+ self.causative_passive_forms[:continuous_forms] = { present_spoken: te_form + endings[0],
1465
+ present_written: te_form + endings[1],
1466
+ present_formal: te_form + endings[2],
1467
+ present_formal_spoken: te_form + endings[3],
1468
+ past_spoken: te_form + endings[4],
1469
+ past_written: te_form + endings[5],
1470
+ past_formal: te_form + endings[6],
1471
+ past_polite_spoken: te_form + endings[7],
1472
+ te_form_spoken: te_form + endings[8],
1473
+ te_form_written: te_form + endings[9],
1474
+ te_form_polite: te_form + endings[10],
1475
+ te_form_polite_spoken: te_form + endings[11],
1476
+ negative_te_form_spoken: te_form + endings[12],
1477
+ negative_te_form_written: te_form + endings[13]
1478
+ }
1479
+
1480
+ self.causative_passive_forms_hiragana[:continuous_forms] = { present_spoken: hiragana_te_form + endings[0],
1481
+ present_written: hiragana_te_form + endings[1],
1482
+ present_formal: hiragana_te_form + endings[2],
1483
+ present_formal_spoken: hiragana_te_form + endings[3],
1484
+ past_spoken: hiragana_te_form + endings[4],
1485
+ past_written: hiragana_te_form + endings[5],
1486
+ past_formal: hiragana_te_form + endings[6],
1487
+ past_polite_spoken: hiragana_te_form + endings[7],
1488
+ te_form_spoken: hiragana_te_form + endings[8],
1489
+ te_form_written: hiragana_te_form + endings[9],
1490
+ te_form_polite: hiragana_te_form + endings[10],
1491
+ te_form_polite_spoken: hiragana_te_form + endings[11],
1492
+ negative_te_form_spoken: hiragana_te_form + endings[12],
1493
+ negative_te_form_written: hiragana_te_form + endings[13]
1494
+ }
1495
+ self.causative_passive_forms_romaji[:continuous_forms] = { present_spoken: romaji_te_form + romaji_endings[0],
1496
+ present_written: romaji_te_form + romaji_endings[1],
1497
+ present_formal: romaji_te_form + romaji_endings[2],
1498
+ present_formal_spoken: romaji_te_form + romaji_endings[3],
1499
+ past_spoken: romaji_te_form + romaji_endings[4],
1500
+ past_written: romaji_te_form + romaji_endings[5],
1501
+ past_formal: romaji_te_form + romaji_endings[6],
1502
+ past_polite_spoken: romaji_te_form + romaji_endings[7],
1503
+ te_form_spoken: romaji_te_form + romaji_endings[8],
1504
+ te_form_written: romaji_te_form + romaji_endings[9],
1505
+ te_form_polite: romaji_te_form + romaji_endings[10],
1506
+ te_form_polite_spoken: romaji_te_form + romaji_endings[11],
1507
+ negative_te_form_spoken: romaji_te_form + romaji_endings[12],
1508
+ negative_te_form_written: romaji_te_form + romaji_endings[13]
1509
+ }
1510
+ end
1511
+
1512
+ def set_causative_passive_conditional
1513
+ stem = self.causative_passive_forms[:stem]
1514
+ hiragana_stem = self.causative_passive_forms_hiragana[:stem]
1515
+ romaji_stem = self.causative_passive_forms_romaji[:stem]
1516
+ self.causative_passive_forms[:conditional] = stem + "ば"
1517
+ self.causative_passive_forms_hiragana[:conditional] = hiragana_stem + "ば"
1518
+ self.causative_passive_forms_romaji[:conditional] = romaji_stem + "ba"
1519
+ end
1520
+ end
1521
+ end