latinverb 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +1 -0
  3. data/Gemfile.lock +28 -6
  4. data/README.markdown +1 -1
  5. data/Rakefile +1 -0
  6. data/latinverb.gemspec +5 -3
  7. data/lib/latinverb/components/chart_presenter.rb +81 -0
  8. data/lib/latinverb/components/classifier/strategies/defective_verb_classification_strategy.rb +19 -0
  9. data/lib/latinverb/components/classifier/strategies/deponent_verb_classification_strategy.rb +19 -0
  10. data/lib/latinverb/components/classifier/strategies/impersonal_verb_classification_strategy.rb +19 -0
  11. data/lib/latinverb/components/classifier/strategies/irregular_verb_classification_strategy.rb +19 -0
  12. data/lib/latinverb/components/classifier/strategies/present_only_verb_classification_strategy.rb +21 -0
  13. data/lib/latinverb/components/classifier/strategies/regular_verb_classification_strategy.rb +19 -0
  14. data/lib/latinverb/components/classifier/strategies/semideponent_verb_classification_strategy.rb +19 -0
  15. data/lib/latinverb/components/classifier/strategies/verb_classification_strategy.rb +31 -0
  16. data/lib/latinverb/components/classifier/strategies/very_irregular_verb_classification_strategy.rb +20 -0
  17. data/lib/latinverb/components/classifier.rb +76 -0
  18. data/lib/latinverb/components/imperatives_handler.rb +40 -0
  19. data/lib/latinverb/components/infinitivizer.rb +50 -0
  20. data/lib/latinverb/components/participler.rb +58 -0
  21. data/lib/latinverb/components/passive_infinitive_factory.rb +42 -0
  22. data/lib/latinverb/components/present_only_checker.rb +32 -0
  23. data/lib/latinverb/components/principal_parts_extractor.rb +35 -0
  24. data/lib/latinverb/components/stem_deriver.rb +81 -0
  25. data/lib/latinverb/components/type_evaluator.rb +35 -0
  26. data/lib/latinverb/components/validator.rb +33 -0
  27. data/lib/latinverb/components.rb +9 -0
  28. data/lib/latinverb/dynamic_method_resolver.rb +41 -0
  29. data/lib/latinverb/errors.rb +10 -0
  30. data/lib/latinverb/imperative_block/imperative_rule_factory.rb +35 -0
  31. data/lib/latinverb/imperative_block.rb +71 -0
  32. data/lib/latinverb/paradigmatic_verbs.rb +21 -0
  33. data/lib/latinverb/serialization/hash.rb +17 -0
  34. data/lib/latinverb/serialization/json.rb +41 -0
  35. data/lib/latinverb/serialization/yaml.rb +15 -0
  36. data/lib/latinverb/serialization.rb +3 -0
  37. data/lib/latinverb/tense_block/null_tense_block.rb +12 -0
  38. data/lib/latinverb/tense_block/vector_resolution_delegate.rb +89 -0
  39. data/lib/latinverb/tense_block.rb +52 -0
  40. data/lib/latinverb/tense_method_applicator/defective_checker.rb +21 -0
  41. data/lib/{linguistics/latin/verb/latinverb/classmethods.rb → latinverb/tense_method_applicator/deponent_string_deriver.rb} +15 -69
  42. data/lib/latinverb/tense_method_applicator/first_builder.rb +98 -0
  43. data/lib/latinverb/tense_method_applicator/fourth.rb +100 -0
  44. data/lib/latinverb/tense_method_applicator/fourth_builder.rb +100 -0
  45. data/lib/latinverb/tense_method_applicator/irregular_builder.rb +117 -0
  46. data/lib/latinverb/tense_method_applicator/mutator_for_classification_factory.rb +38 -0
  47. data/lib/latinverb/tense_method_applicator/mutator_for_verb_type.rb +38 -0
  48. data/lib/latinverb/tense_method_applicator/mutators/deponent/imperative_mutator.rb +49 -0
  49. data/lib/latinverb/tense_method_applicator/mutators/deponent/infinitive_mutator.rb +42 -0
  50. data/lib/latinverb/tense_method_applicator/mutators/deponent/participle_mutator.rb +47 -0
  51. data/lib/latinverb/tense_method_applicator/mutators/deponent/tense_block_mutator.rb +55 -0
  52. data/lib/latinverb/tense_method_applicator/mutators/deponent.rb +41 -0
  53. data/lib/latinverb/tense_method_applicator/mutators/impersonal.rb +27 -0
  54. data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_imperative_mood_future_tense_strategy.rb +29 -0
  55. data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_imperative_mood_present_tense_strategy.rb +29 -0
  56. data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_indicative_mood_future_tense_strategy.rb +35 -0
  57. data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_indicative_mood_futureperfect_tense_strategy.rb +28 -0
  58. data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_indicative_mood_imperfect_tense_strategy.rb +24 -0
  59. data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_indicative_mood_pastperfect_tense_strategy.rb +28 -0
  60. data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_indicative_mood_perfect_tense_strategy.rb +29 -0
  61. data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_indicative_mood_present_tense_strategy.rb +24 -0
  62. data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_subjunctive_mood_imperfect_tense_strategy.rb +29 -0
  63. data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_subjunctive_mood_pastperfect_tense_strategy.rb +30 -0
  64. data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_subjunctive_mood_perfect_tense_strategy.rb +30 -0
  65. data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_subjunctive_mood_present_tense_strategy.rb +24 -0
  66. data/lib/latinverb/tense_method_applicator/mutators/invariant/imperatives.rb +53 -0
  67. data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_indicative_mood_future_tense_strategy.rb +24 -0
  68. data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_indicative_mood_futureperfect_tense_strategy.rb +27 -0
  69. data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_indicative_mood_imperfect_tense_strategy.rb +24 -0
  70. data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_indicative_mood_pastperfect_tense_strategy.rb +27 -0
  71. data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_indicative_mood_perfect_tense_strategy.rb +27 -0
  72. data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_indicative_mood_present_tense_strategy.rb +24 -0
  73. data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_subjunctive_mood_imperfect_tense_strategy.rb +30 -0
  74. data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_subjunctive_mood_pastperfect_tense_strategy.rb +33 -0
  75. data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_subjunctive_mood_perfect_tense_strategy.rb +33 -0
  76. data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_subjunctive_mood_present_tense_strategy.rb +24 -0
  77. data/lib/latinverb/tense_method_applicator/mutators/invariant/triplicate_and_pluralize_formatters.rb +26 -0
  78. data/lib/latinverb/tense_method_applicator/mutators/invariant.rb +65 -0
  79. data/lib/latinverb/tense_method_applicator/mutators/irregular/infinitives_builder.rb +35 -0
  80. data/lib/latinverb/tense_method_applicator/mutators/irregular/json_deserializer.rb +52 -0
  81. data/lib/latinverb/tense_method_applicator/mutators/irregular/json_revivifier.rb +48 -0
  82. data/lib/latinverb/tense_method_applicator/mutators/irregular/participles_builder.rb +35 -0
  83. data/lib/latinverb/tense_method_applicator/mutators/irregular/present_only_irregular_mask.rb +37 -0
  84. data/lib/latinverb/tense_method_applicator/mutators/irregular.rb +25 -0
  85. data/lib/latinverb/tense_method_applicator/mutators/present_only.rb +18 -0
  86. data/lib/latinverb/tense_method_applicator/mutators/regular.rb +17 -0
  87. data/lib/latinverb/tense_method_applicator/mutators/semideponent.rb +88 -0
  88. data/lib/latinverb/tense_method_applicator/perfect_tense_remover.rb +26 -0
  89. data/lib/latinverb/tense_method_applicator/second_builder.rb +105 -0
  90. data/lib/latinverb/tense_method_applicator/tense_methods_vectorizer.rb +73 -0
  91. data/lib/latinverb/tense_method_applicator/third_builder.rb +93 -0
  92. data/lib/latinverb/tense_method_applicator/thirdio_builder.rb +100 -0
  93. data/lib/latinverb/tense_method_applicator.rb +55 -0
  94. data/lib/latinverb/version.rb +2 -3
  95. data/lib/latinverb.rb +63 -419
  96. data/test/{testDeponentFirstConjugation.rb → integration/deponent_first_conjugation_test.rb} +1 -1
  97. data/test/{testDeponentFourthConjugation.rb → integration/deponent_fourth_conjugation_test.rb} +1 -1
  98. data/test/{testDeponentSecondConjugation.rb → integration/deponent_second_conjugation_test.rb} +1 -1
  99. data/test/{testDeponentThirdConjugation.rb → integration/deponent_third_conjugation_test.rb} +2 -2
  100. data/test/{testDeponentThirdIOConjugation.rb → integration/deponent_third_io_conjugation_test.rb} +1 -1
  101. data/test/{testFirstConjugation.rb → integration/first_conjugation_test.rb} +3 -7
  102. data/test/{testFreakishVerbs.rb → integration/freakish_vs.rb_test.rb} +4 -4
  103. data/test/{testIrregularSum.rb → integration/irregular_sum_test.rb} +1 -1
  104. data/test/{testIrregulars.rb → integration/irregulars_test.rb} +1 -1
  105. data/test/{testLatinVerb.rb → integration/latin_verb_test.rb} +5 -25
  106. data/test/{testThirdConjugation.rb → integration/third_conjugation_test.rb} +19 -21
  107. data/test/unit/latinverb_accessible_reader_test.rb +18 -0
  108. data/test/unit/principal_parts_extractor_test.rb +33 -0
  109. metadata +151 -79
  110. data/lib/latinverb/chart.rb +0 -94
  111. data/lib/linguistics/latin/verb/classification_types.rb +0 -61
  112. data/lib/linguistics/latin/verb/constants.rb +0 -201
  113. data/lib/linguistics/latin/verb/deponent_tense_methods.rb +0 -85
  114. data/lib/linguistics/latin/verb/imperative_block.rb +0 -118
  115. data/lib/linguistics/latin/verb/infinitive_block.rb +0 -39
  116. data/lib/linguistics/latin/verb/infinitives.rb +0 -212
  117. data/lib/linguistics/latin/verb/irregulars.rb +0 -4393
  118. data/lib/linguistics/latin/verb/latinverb/data.rb +0 -87
  119. data/lib/linguistics/latin/verb/latinverb/defective_checker.rb +0 -17
  120. data/lib/linguistics/latin/verb/latinverb/deponent.rb +0 -159
  121. data/lib/linguistics/latin/verb/latinverb/display.rb +0 -22
  122. data/lib/linguistics/latin/verb/latinverb/impersonal.rb +0 -34
  123. data/lib/linguistics/latin/verb/latinverb/irregular.rb +0 -83
  124. data/lib/linguistics/latin/verb/latinverb/latin_verb_type_evaluator.rb +0 -32
  125. data/lib/linguistics/latin/verb/latinverb/latinverb_classifier.rb +0 -100
  126. data/lib/linguistics/latin/verb/latinverb/latinverb_input_sanitizer.rb +0 -32
  127. data/lib/linguistics/latin/verb/latinverb/latinverb_pp_extractor.rb +0 -106
  128. data/lib/linguistics/latin/verb/latinverb/metaprogramming.rb +0 -80
  129. data/lib/linguistics/latin/verb/latinverb/semideponent.rb +0 -28
  130. data/lib/linguistics/latin/verb/latinverb/validation.rb +0 -42
  131. data/lib/linguistics/latin/verb/latinverb/verbvector_description.rb +0 -50
  132. data/lib/linguistics/latin/verb/participle_block.rb +0 -36
  133. data/lib/linguistics/latin/verb/participles.rb +0 -202
  134. data/lib/linguistics/latin/verb/phonographia.rb +0 -109
  135. data/lib/linguistics/latin/verb/supine.rb +0 -42
  136. data/lib/linguistics/latin/verb/tense_block.rb +0 -227
  137. data/lib/linguistics/latin/verb/tense_definitions/first.rb +0 -92
  138. data/lib/linguistics/latin/verb/tense_definitions/fourth.rb +0 -92
  139. data/lib/linguistics/latin/verb/tense_definitions/impersonal.rb +0 -25
  140. data/lib/linguistics/latin/verb/tense_definitions/invariant.rb +0 -613
  141. data/lib/linguistics/latin/verb/tense_definitions/irregular.rb +0 -82
  142. data/lib/linguistics/latin/verb/tense_definitions/second.rb +0 -97
  143. data/lib/linguistics/latin/verb/tense_definitions/third.rb +0 -86
  144. data/lib/linguistics/latin/verb/tense_definitions/third_io.rb +0 -91
  145. data/test/testDeserializeInfinitives.rb +0 -36
  146. /data/test/{testAmbiguousLookups.rb → integration/ambiguous_lookups_test.rb} +0 -0
  147. /data/test/{testClusterResolution.rb → integration/cluster_resolution_test.rb} +0 -0
  148. /data/test/{testDataStructures.rb → integration/data_structures_test.rb} +0 -0
  149. /data/test/{testDefectSemiImp.rb → integration/defect_semi_imp_test.rb} +0 -0
  150. /data/test/{testFourthConjugation.rb → integration/fourth_conjugation_test.rb} +0 -0
  151. /data/test/{testImperativeBlock.rb → integration/imperative_block_test.rb} +0 -0
  152. /data/test/{testMacronRules.rb → integration/macron_rules_test.rb} +0 -0
  153. /data/test/{testSecondConjugation.rb → integration/second_conjugation_test.rb} +0 -0
  154. /data/test/{testThirdIOConjugation.rb → integration/third_io_conjugation_test.rb} +0 -0
@@ -1,613 +0,0 @@
1
- # encoding: UTF-8
2
- # vim: set fdm=marker tw=80 sw=2:
3
-
4
- module Linguistics
5
- module Latin
6
- module Verb
7
- module TenseDefinitions
8
- ##
9
- #
10
- # Tense-forming methods that do not vary between the verb types
11
- #
12
- ##
13
- module Invariant
14
- ##
15
- #
16
- # === GRAMMATICAL FUNCTION
17
- #
18
- # Commands for immediate action. Always second person.
19
- #
20
- # === ARGUMENTS
21
- #
22
- # None
23
- #
24
- # === RETURNS
25
- #
26
- # TenseBlock
27
- #
28
- ###
29
- def active_voice_imperative_mood_present_tense
30
- imp = imperatives
31
- TenseBlock.new( [ '', imp.present_tense_singular_number, '',
32
- '', imp.present_tense_plural_number, ''
33
- ],
34
- { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_imperative_mood_present_tense] }
35
- )
36
- end
37
-
38
- ##
39
- #
40
- # === GRAMMATICAL FUNCTION
41
- #
42
- # Commands for immediate action. Only supports second or third
43
- # person.
44
- #
45
- # === ARGUMENTS
46
- #
47
- # None
48
- #
49
- # === RETURNS
50
- #
51
- # TenseBlock
52
- #
53
- ###
54
- def active_voice_imperative_mood_future_tense# {{{
55
- f = imperatives.future
56
- return TenseBlock.new( [ '', f[0], f[2],
57
- '', f[1], f[3]
58
- ],
59
- { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_imperative_mood_future_tense] }
60
- )
61
- end# }}}
62
-
63
- ##
64
- #
65
- # === GRAMMATICAL FUNCTION
66
- #
67
- # Action completed in the future.
68
- # A&G,160,b,3.
69
- #
70
- # === ARGUMENTS
71
- #
72
- # None
73
- #
74
- # === RETURNS
75
- #
76
- # TenseBlock
77
- #
78
- ###
79
- def active_voice_indicative_mood_futureperfect_tense# {{{
80
- substem = first_person_perfect[0..-2]
81
- return TenseBlock.new [Linguistics::Latin::Verb::LatinVerb::APERF_FUTURE_ENDINGS.collect{|x| substem+x}].flatten,
82
- { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_indicative_mood_futureperfect_tense] }
83
- end# }}}
84
-
85
- ##
86
- #
87
- # === GRAMMATICAL FUNCTION
88
- #
89
- # Action completed in the past prior to an event in the past.
90
- # A&G,160,b,3.
91
- #
92
- # === ARGUMENTS
93
- #
94
- # None
95
- #
96
- # === RETURNS
97
- #
98
- # TenseBlock
99
- #
100
- ###
101
- def active_voice_indicative_mood_pastperfect_tense# {{{
102
- substem = first_person_perfect[0..-2]
103
- return TenseBlock.new [Linguistics::Latin::Verb::LatinVerb::APERF_PAST_ENDINGS.collect{|x| substem+x}].flatten,
104
- { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_indicative_mood_pastperfect_tense] }
105
- end# }}}
106
-
107
- ##
108
- #
109
- # === GRAMMATICAL FUNCTION
110
- #
111
- # <em>Refer to "Moods," above. Tense is constrained by function of
112
- # the verb in context.</em>
113
- #
114
- # === ARGUMENTS
115
- #
116
- # None
117
- #
118
- # === RETURNS
119
- #
120
- # TenseBlock
121
- #
122
- ###
123
- def active_voice_subjunctive_mood_imperfect_tense
124
- TenseBlock.new(
125
- ['m', Linguistics::Latin::Verb::LatinVerb::AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS].flatten!.map do |ending|
126
- present_active_infinitive.sub(/e$/,'ē') + ending
127
- end,
128
- { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_subjunctive_mood_imperfect_tense] }
129
- )
130
- end
131
-
132
- ##
133
- #
134
- # === GRAMMATICAL FUNCTION
135
- #
136
- # Action completed in the past. A&G,160,b,1.
137
- #
138
- # === ARGUMENTS
139
- #
140
- # None
141
- #
142
- # === RETURNS
143
- #
144
- # TenseBlock
145
- #
146
- ###
147
- def active_voice_indicative_mood_perfect_tense# {{{
148
- substem = first_person_perfect[0..-2]
149
- return TenseBlock.new [first_person_perfect.to_s, Linguistics::Latin::Verb::LatinVerb::APERF_ENDINGS.collect{|x| substem+x.to_s}].flatten,
150
- { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_indicative_mood_perfect_tense] }
151
- end# }}}
152
-
153
- ##
154
- #
155
- # === GRAMMATICAL FUNCTION
156
- #
157
- # <em>Refer to "Moods," above. Tense is constrained by function of
158
- # the verb in context.</em>
159
- #
160
- # === ARGUMENTS
161
- #
162
- # None
163
- #
164
- # === RETURNS
165
- #
166
- # TenseBlock
167
- #
168
- ###
169
- def active_voice_subjunctive_mood_pastperfect_tense# {{{
170
- asp_base = first_person_perfect[0..first_person_perfect.length-2] + "issē"
171
- TenseBlock.new( ['m', Linguistics::Latin::Verb::LatinVerb::AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS].flatten!.map do |ending|
172
- asp_base + ending
173
- end,
174
- { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_subjunctive_mood_pastperfect_tense] }
175
- )
176
- end# }}}
177
-
178
- ##
179
- #
180
- # === GRAMMATICAL FUNCTION
181
- #
182
- # <em>Refer to "Moods," above. Tense is constrained by function of
183
- # the verb in context.</em>
184
- #
185
- # === ARGUMENTS
186
- #
187
- # None
188
- #
189
- # === RETURNS
190
- #
191
- # TenseBlock
192
- #
193
- ###
194
- def active_voice_subjunctive_mood_perfect_tense
195
- asp_base =
196
- first_person_perfect[0..first_person_perfect.length-2] +
197
- "erī"
198
- TenseBlock.new(
199
- ['m', Linguistics::Latin::Verb::LatinVerb::AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS].flatten!.map do |ending|
200
- asp_base + ending
201
- end,
202
- { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:active_voice_subjunctive_mood_perfect_tense] }
203
- )
204
- end
205
-
206
- ##
207
- #
208
- # === GRAMMATICAL FUNCTION
209
- #
210
- # <em>Refer to "Voice" section in reference, for function consult
211
- # active-voice counterpart.</em>
212
- # Wheelock, 122
213
- #
214
- # === ARGUMENTS
215
- #
216
- # None
217
- #
218
- # === RETURNS
219
- #
220
- # TenseBlock
221
- #
222
- ###
223
- def passive_voice_indicative_mood_futureperfect_tense# {{{
224
- return TenseBlock.new(
225
- Linguistics::Latin::Verb::LatinVerb::PASS_PERF_FUTURE_ENDINGS.map{ |helping_verb| "#{passive_perfect_participle} #{helping_verb}" },
226
- { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_indicative_mood_futureperfect_tense] }
227
- )
228
- end# }}}
229
-
230
- ##
231
- #
232
- # === GRAMMATICAL FUNCTION
233
- #
234
- # <em>Refer to "Voice" section in reference, for function consult
235
- # active-voice counterpart.</em>
236
- # Wheelock, 117
237
- #
238
- # === ARGUMENTS
239
- #
240
- # None
241
- #
242
- # === RETURNS
243
- #
244
- # TenseBlock
245
- #
246
- ###
247
- def passive_voice_indicative_mood_pastperfect_tense# {{{
248
- TenseBlock.new(
249
- Linguistics::Latin::Verb::LatinVerb::PASS_PERF_PAST_ENDINGS.map{ |helping_verb| "#{passive_perfect_participle} #{helping_verb}" },
250
- { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_indicative_mood_pastperfect_tense]}
251
- )
252
- end# }}}
253
-
254
- ##
255
- #
256
- # === GRAMMATICAL FUNCTION
257
- #
258
- # Wheelock, 122
259
- #
260
- # === ARGUMENTS
261
- #
262
- # None
263
- #
264
- # === RETURNS
265
- #
266
- # TenseBlock
267
- #
268
- ###
269
- def passive_voice_indicative_mood_perfect_tense
270
- TenseBlock.new(
271
- Linguistics::Latin::Verb::LatinVerb::PASS_PERF_PRESENT_ENDINGS.map{ |helping_verb| "#{passive_perfect_participle} #{helping_verb}" },
272
- { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_indicative_mood_perfect_tense] }
273
- )
274
- end
275
-
276
- ##
277
- #
278
- # === GRAMMATICAL FUNCTION
279
- #
280
- # <em>Refer to "Moods," above. Tense is constrained by function of
281
- # the verb in context.</em>
282
- #
283
- # === ARGUMENTS
284
- #
285
- # None
286
- #
287
- # === RETURNS
288
- #
289
- # TenseBlock
290
- #
291
- ###
292
- def passive_voice_subjunctive_mood_imperfect_tense
293
- base = present_active_infinitive.gsub(/(.*)(.)$/,"\\1" + 'ē')
294
- TenseBlock.new(
295
- Linguistics::Latin::Verb::LatinVerb::PASSIVE_ENDINGS_FIRST_AND_SECOND_CONJG.map do |ending|
296
- base + ending
297
- end,
298
- { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_subjunctive_mood_imperfect_tense] }
299
- )
300
- end
301
-
302
- ##
303
- #
304
- # === GRAMMATICAL FUNCTION
305
- #
306
- # <em>Refer to "Moods," above. Tense is constrained by function of
307
- # the verb in context.</em>
308
- #
309
- # === ARGUMENTS
310
- #
311
- # None
312
- #
313
- # === RETURNS
314
- #
315
- # TenseBlock
316
- #
317
- ###
318
- def passive_voice_subjunctive_mood_pastperfect_tense# {{{
319
- count = -1
320
- TenseBlock.new(Linguistics::Latin::Verb::LatinVerb::PASS_PLUPERF_PAST_ENDINGS.map do |ending|
321
- count += 1
322
- (count <= 2 ?
323
- "[ #{triplicate_and_genderize passive_perfect_participle} ]" :
324
- "[ #{pluralize_participial_listing(triplicate_and_genderize(passive_perfect_participle))} ]" )+ " " + ending
325
- end,
326
- { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_subjunctive_mood_pastperfect_tense] }
327
- )
328
- end# }}}
329
-
330
- ##
331
- #
332
- # === GRAMMATICAL FUNCTION
333
- #
334
- # <em>Refer to "Moods," above. Tense is constrained by function of
335
- # the verb in context.</em>
336
- #
337
- # === ARGUMENTS
338
- #
339
- # None
340
- #
341
- # === RETURNS
342
- #
343
- # TenseBlock
344
- #
345
- ###
346
- def passive_voice_subjunctive_mood_perfect_tense
347
- counter = -1
348
- TenseBlock.new(Linguistics::Latin::Verb::LatinVerb::PASS_PERF_SUBJUNCTIVE_ENDINGS.map do |ending|
349
- counter += 1
350
- (counter <=2 ?
351
- "[ #{triplicate_and_genderize passive_perfect_participle} ]" :
352
- "[ #{pluralize_participial_listing(triplicate_and_genderize(passive_perfect_participle))} ]" )+ " " + ending
353
- end,
354
- { :meaning => Linguistics::Latin::Verb::LatinVerb::MEANINGS[:passive_voice_subjunctive_mood_perfect_tense] }
355
- )
356
- end
357
-
358
- ##
359
- #
360
- # === GRAMMATICAL FUNCTION
361
- #
362
- # Used to express command. As A&G notes, oftentimes the Subjunctive
363
- # is the correct mood for exhortation.
364
- #
365
- # === ARGUMENTS
366
- #
367
- # None
368
- #
369
- # === RETURNS
370
- #
371
- # TenseBlock
372
- #
373
- ###
374
- def imperatives
375
- @imperatives ||= form_imperatives
376
- end
377
-
378
- def form_imperatives# {{{
379
-
380
- imperative_exceptions = {
381
- "ducere" => %w(duc ducite),
382
- "dicere" => %w(dic dicite),
383
- "facere" => %w(fac facite),
384
- "ferre" => %w(fer ferte),
385
- "nolere" => %w(nolo nolite)
386
- }
387
-
388
- # Exceptional imperatives. If we have one, return it straight away.
389
- if imperative_exceptions.has_key?(present_active_infinitive)
390
- return Linguistics::Latin::Verb::ImperativeBlock.new(
391
- imperative_exceptions[present_active_infinitive])
392
- end
393
-
394
- # Therefore, let us assume that we are dealing with a standard verb
395
- # with standard imperatives. Accordingly, we will create an
396
- # ImperativeBlock.
397
-
398
- return Linguistics::Latin::Verb::ImperativeBlock.new stem, present_active_infinitive
399
- end# }}}
400
-
401
- ##
402
- #
403
- # === DESCRIPTION
404
- #
405
- # Used for handling verb states that are compounds like _amatus,
406
- # amata, amatum sum_ and converting them to amati, amatae, amata,
407
- # (sumus|estis|sunt).
408
- #
409
- # === ARGUMENTS
410
- #
411
- # +x:+ :: A string that looks like --us, --a, --um
412
- # This method mutates those singular endings to plural forms
413
- #
414
- # === RETURNS
415
- #
416
- # Altered string
417
- #
418
- # === EXAMPLE
419
- #
420
- # pluralize_participial_listing(qq/amatus, amata, amatum/) #=>
421
- # amatī, amatae, amata
422
- #
423
- ##
424
- def pluralize_participial_listing(x)
425
- x.sub!(/us,/, 'ī,' )
426
- x.sub!(/a,/, 'ae,')
427
- x.sub!(/um.*$/, 'a' )
428
- end
429
-
430
- ##
431
- #
432
- # === DESCRIPTION
433
- #
434
- # Used for turning a participial form --um into --us, --a, --um
435
- #
436
- # === ARGUMENTS
437
- #
438
- # +s:+ :: --um
439
- #
440
- # === RETURNS
441
- #
442
- # Altered string
443
- #
444
- # === EXAMPLE
445
- #
446
- # triplicate_and_genderize("amatum") #=> amatus, amata, amatum
447
- #
448
- ##
449
- def triplicate_and_genderize(s)# {{{
450
- stem = s.sub(/^(.*)um$/,"\\1")
451
- [ stem + 'us',
452
- stem + 'a',
453
- s
454
- ].join(', ')
455
- end# }}}
456
-
457
- ##
458
- #
459
- # === GRAMMATICAL FUNCTION
460
- #
461
- # Action to be completed in the future. A&G,160,a,3.
462
- #
463
- # === ARGUMENTS
464
- #
465
- # None
466
- #
467
- # === RETURNS
468
- #
469
- # TenseBlock
470
- #
471
- ###
472
- def active_voice_indicative_mood_future_tense
473
- end
474
-
475
- ##
476
- #
477
- # === GRAMMATICAL FUNCTION
478
- #
479
- # Habitual action in the past. A&G,160,a,2.
480
- #
481
- # === ARGUMENTS
482
- #
483
- # None
484
- #
485
- # === RETURNS
486
- #
487
- # TenseBlock
488
- #
489
- ###
490
- def active_voice_indicative_mood_imperfect_tense
491
- end
492
-
493
- ##
494
- #
495
- # === GRAMMATICAL FUNCTION
496
- #
497
- # The canonical building block of learning to conjugate verbs in
498
- # Latin. Take the present active infinitive, chop off the ending, and
499
- # add the classic o,s,t,mus,tis,nt
500
- #
501
- # Wheelock Reference, p. 4.
502
- # A&G, 160,a,1.
503
- #
504
- # === ARGUMENTS
505
- #
506
- # None
507
- #
508
- # === RETURNS
509
- #
510
- # TenseBlock
511
- #
512
- ###
513
- def active_voice_indicative_mood_present_tense
514
- end
515
-
516
- ##
517
- #
518
- # === GRAMMATICAL FUNCTION
519
- #
520
- # <em>Refer to "Moods," above. Tense is constrained by function of
521
- # the verb in context.</em>
522
- #
523
- # === ARGUMENTS
524
- #
525
- # None
526
- #
527
- # === RETURNS
528
- #
529
- # TenseBlock
530
- #
531
- ###
532
- def active_voice_subjunctive_mood_present_tense
533
- end
534
- ##
535
- #
536
- # === GRAMMATICAL FUNCTION
537
- #
538
- # <em>Refer to "Voice" section in reference, for function consult
539
- # active-voice counterpart.</em>
540
- #
541
- # === ARGUMENTS
542
- #
543
- # None
544
- #
545
- # === RETURNS
546
- #
547
- # TenseBlock
548
- #
549
- ###
550
- def passive_voice_indicative_mood_future_tense
551
- end
552
- ##
553
- #
554
- # === GRAMMATICAL FUNCTION
555
- #
556
- # <em>Refer to "Voice" section in reference, for function consult
557
- # active-voice counterpart.</em>
558
- # Wheelock, 117
559
- #
560
- # === ARGUMENTS
561
- #
562
- # None
563
- #
564
- # === RETURNS
565
- #
566
- # TenseBlock
567
- #
568
- ###
569
- def passive_voice_indicative_mood_imperfect_tense
570
- end
571
- ##
572
- #
573
- # === GRAMMATICAL FUNCTION
574
- #
575
- # <em>Refer to "Voice" section in reference, for function consult
576
- # active-voice counterpart.</em>
577
- # Wheelock, 117
578
- #
579
- # === ARGUMENTS
580
- #
581
- # None
582
- #
583
- #
584
- # === RETURNS
585
- #
586
- # TenseBlock
587
- #
588
- ###
589
- def passive_voice_indicative_mood_present_tense
590
- end
591
- ##
592
- #
593
- # === GRAMMATICAL FUNCTION
594
- #
595
- # <em>Refer to "Moods," above. Tense is constrained by function of
596
- # the verb in context.</em>
597
- #
598
- # === ARGUMENTS
599
- #
600
- # None
601
- #
602
- # === RETURNS
603
- #
604
- # TenseBlock
605
- #
606
- ###
607
- def passive_voice_subjunctive_mood_present_tense
608
- end
609
- end
610
- end
611
- end
612
- end
613
- end
@@ -1,82 +0,0 @@
1
- # encoding: UTF-8
2
- # vim: set fdm=marker tw=80 sw=2 wrap:
3
-
4
- module Linguistics
5
- module Latin
6
- module Verb
7
- module TenseDefinitions
8
- module Irregular
9
- def self.included(inclusor)
10
- begin
11
- os_sym = self.symbolize_original_string @original_string
12
- json_string = Linguistics::Latin::Verb.const_get os_sym
13
-
14
- raise "Found a JSON string with null length!" if json_string.length <= 10
15
- revivified_data_structure = JSON.parse json_string
16
- rescue JSON::ParserError => e
17
- puts "We were unable to parse JSON for #{@original_string} [o:#{o}] [o_sym:#{o_upcase_and_symbolic}]. Please verify your syntax."
18
- raise e
19
- rescue NameError => e
20
- puts "We were unable to find a definition for #{@original_string} [o:#{o}] [o_sym:#{o_upcase_and_symbolic}]. Please provide one."
21
- raise e
22
- rescue => error
23
- warn "#{@original_string} was identified as irregular but did not have a definition provided."
24
- raise error
25
- end
26
-
27
- revivified_data_structure['tense_blocks'].each_pair do |k,v|
28
- singleton_class.class_eval do
29
- define_method k.to_sym do
30
- TenseBlock.new v, { :meaning => MEANINGS[k.to_sym] }
31
- end
32
- end
33
- end
34
-
35
- @irregular_infinitives = revivified_data_structure['infinitives']
36
- @irregular_participles = revivified_data_structure['participles']
37
-
38
- return if @irregular_infinitives.nil?
39
- return if @irregular_participles.nil?
40
-
41
- singleton_class.class_eval do
42
- def present_active_infinitive; return @irregular_infinitives.present_active_infinitive; end
43
- def present_passive_infinitive; return @irregular_infinitives.present_passive_infinitive; end
44
- def perfect_active_infinitive; return @irregular_infinitives.perfect_active_infinitive; end
45
- def perfect_passive_infinitive; return @irregular_infinitives.perfect_passive_infinitive; end
46
- def future_passive_infinitive; return @irregular_infinitives.future_passive_infinitive; end
47
- def future_active_infinitive; return @irregular_infinitives.future_active_infinitive; end
48
- end
49
- singleton_class.class_eval do
50
- def present_active_participle; return @irregular_participles.present_active_participle; end
51
- def future_active_participle; return @irregular_participles.future_active_participle; end
52
- def perfect_passive_participle; return @irregular_participles.perfect_passive_participle; end
53
- def future_passive_participle; return @irregular_participles.future_passive_participle; end
54
- def gerundive; return @irregular_participles.gerundive; end
55
- def gerund; return @irregular_participles.d; end
56
- end
57
- end
58
-
59
- def self.symbolize_original_string
60
- # Translation added to account for Ruby not liking constants /^/
61
- # with a multibyte. Probably a bug.
62
- #
63
- # This bug can be discovered by running #constants on
64
- # Linguistics::Latin::Verb and seeing that Ōxxx is not found. To
65
- # fix this i had to store it as ODI_. To make /that/ hack work, I
66
- # had to add this bit beginning two lines below :-/
67
- o = ActiveSupport::Multibyte::Chars.new( @original_string.gsub(/\s+/,'_') ).upcase
68
-
69
- if o.match(/^([ĀĒĪŌŪ])(.*)/)
70
- x=o[0,1].tr 'ĀĒĪŌŪ', 'AEIOU'
71
- y=o[1,o.length]
72
- o= x+y
73
- end
74
-
75
- o.to_sym
76
- end
77
- end
78
- end
79
- end
80
- end
81
- end
82
-