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
@@ -0,0 +1,42 @@
1
+ module Linguistics
2
+ module Latin
3
+ module Verb
4
+ class LatinVerb
5
+ module Mutators
6
+ class Deponent
7
+ class InfinitiveMutator
8
+ def initialize(verb, proxyVerb)
9
+ @verb = verb
10
+ @proxyVerb = proxyVerb
11
+ mutate!
12
+ end
13
+
14
+ def mutate!
15
+ proxyVerb = @proxyVerb
16
+ @verb.instance_eval do
17
+ @proxyVerb = proxyVerb
18
+
19
+ def present_active_infinitive
20
+ return @proxyVerb.send :present_passive_infinitive
21
+ end
22
+
23
+ def perfect_active_infinitive
24
+ return @proxyVerb.send :perfect_passive_infinitive
25
+ end
26
+
27
+ def future_active_infinitive
28
+ return @proxyVerb.send :future_active_infinitive
29
+ end
30
+
31
+ def present_passive_infinitive
32
+ return NullTenseBlock.new
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,47 @@
1
+ module Linguistics
2
+ module Latin
3
+ module Verb
4
+ class LatinVerb
5
+ module Mutators
6
+ class Deponent
7
+ class ParticipleMutator
8
+ def initialize(verb, proxyVerb)
9
+ @verb = verb
10
+ @proxyVerb = proxyVerb
11
+ mutate!
12
+ end
13
+
14
+ def mutate!
15
+ proxyVerb = @proxyVerb
16
+ @verb.instance_eval do
17
+ @proxyVerb = proxyVerb
18
+
19
+ def present_active_participle
20
+ return @proxyVerb.present_active_participle
21
+ end
22
+
23
+ def future_active_participle
24
+ return @proxyVerb.future_active_participle
25
+ end
26
+
27
+ def perfect_active_participle
28
+ return @proxyVerb.perfect_passive_participle
29
+ end
30
+
31
+ def future_passive_participle
32
+ return @proxyVerb.future_passive_participle
33
+ end
34
+
35
+ # Mask the supine
36
+ def supine
37
+ return @proxyVerb.supine
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,55 @@
1
+ module Linguistics
2
+ module Latin
3
+ module Verb
4
+ class LatinVerb
5
+ module Mutators
6
+ class Deponent
7
+ class TenseBlockMutator
8
+ def initialize(verb, proxyVerb)
9
+ @verb = verb
10
+ @proxyVerb = proxyVerb
11
+
12
+ mutate!
13
+ end
14
+
15
+ ##
16
+ #
17
+ # Swaps this verb's active_ vectors and replaces them with
18
+ # @proxyVerb's passive_ vectors. This is pretty darned sneaky. See
19
+ # Also deponent_swap
20
+ #
21
+ ##
22
+ def mutate!
23
+ # First, get the methods that were defined in the proxy as passive
24
+
25
+ storage = {}
26
+
27
+ @proxyVerb.methods.grep(/\Apassive.+tense\z/).each do |pass|
28
+ # Find the active correlate
29
+ active_corr = pass.to_s.sub( /^passive(.*)/, "active\\1" )
30
+
31
+ # Keep @proxyVerb in the binding scope
32
+ pV = @proxyVerb
33
+
34
+ # In verb, find the passive and save its resultant object into a
35
+ # hash for future use.
36
+ @verb.instance_eval do
37
+ storage[active_corr.to_sym] = pV.send(pass)
38
+ end
39
+ end
40
+
41
+ # Take the stored hashes and define instance methods on verb such
42
+ # that we intercept the mixed-in methods ( C-c-c-combo breaker! ).
43
+ storage.each_pair do |k,v|
44
+ @verb.singleton_class.class_eval do
45
+ define_method k, Proc.new { return v }
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,41 @@
1
+ require_relative './deponent/tense_block_mutator'
2
+ require_relative './deponent/imperative_mutator'
3
+ require_relative './deponent/participle_mutator'
4
+ require_relative './deponent/infinitive_mutator'
5
+
6
+ module Linguistics
7
+ module Latin
8
+ module Verb
9
+ class LatinVerb
10
+ module Mutators
11
+ class Deponent
12
+ # In a bit of cleverness, if the verb is deponent, we have built out
13
+ # this verb as if it were regular, but we have also created a
14
+ # @proxyVerb which is the active 'pseudo verb' corresponding to this
15
+ # verb. We should be able to take this verb's active formulations
16
+ # and set their results to the @proxyVerb's passive formulations
17
+ #
18
+ # Ergo: miror/mirari/miratus =~
19
+ # miro/mirare/PreventDeponentInfiniteRegress/miratus Therefore make a
20
+ # LatinVerb.new(miro/mirare/PreventDeponentInfiniteRegress/miratus).
21
+ # Take its passives and set them to this verb's actives. This is
22
+ # actually what students do heuristically in Latin classes.
23
+
24
+ include Linguistics::Latin::Phonographia
25
+
26
+ def initialize(verb, opts={})
27
+ @verb = verb
28
+ @proxyVerb = LatinVerb.new(DeponentStringDeriver.new(@verb.original_string).proxy_string)
29
+ @mutators_classes = opts[:mutator_classes] ||
30
+ [ TenseBlockMutator, ImperativeMutator, ParticipleMutator, InfinitiveMutator ]
31
+ end
32
+
33
+ def mutate!
34
+ @mutators_classes.each{ |m| m.new(@verb, @proxyVerb) }
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,27 @@
1
+ module Linguistics
2
+ module Latin
3
+ module Verb
4
+ class LatinVerb
5
+ module Mutators
6
+ class Impersonal
7
+ def initialize(verb)
8
+ @verb = verb
9
+ end
10
+
11
+ def mutate!
12
+ @verb.instance_eval do
13
+ def active_voice_indicative_mood_present_tense
14
+ TenseBlock.new ["", "", @original_string, "", "", ""]
15
+ end
16
+
17
+ def active_voice_indicative_mood_present_tense_third_person_singular_number
18
+ return active_voice_indicative_mood_present_tense[2]
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,29 @@
1
+ module Linguistics
2
+ module Latin
3
+ module Verb
4
+ class LatinVerb
5
+ module Mutators
6
+ class Invariant
7
+ class ActiveVoiceImperativeMoodFutureTenseStrategy
8
+ def initialize(verb)
9
+ @verb = verb
10
+ end
11
+
12
+ def apply!
13
+ @verb.instance_eval do
14
+ def active_voice_imperative_mood_future_tense
15
+ f = imperatives.future
16
+ return TenseBlock.new(
17
+ [ '', f[0], f[2], '', f[1], f[3] ],
18
+ { :meaning => MEANINGS[:active_voice_imperative_mood_future_tense] }
19
+ )
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ module Linguistics
2
+ module Latin
3
+ module Verb
4
+ class LatinVerb
5
+ module Mutators
6
+ class Invariant
7
+ # Commands for immediate action. Always second person.
8
+ class ActiveVoiceImperativeMoodPresentTenseStrategy
9
+ def initialize(verb)
10
+ @verb = verb
11
+ end
12
+
13
+ def apply!
14
+ @verb.instance_eval do
15
+ def active_voice_imperative_mood_present_tense
16
+ imp = imperatives
17
+ elements = [ '', imp.present_tense_singular_number, '', '', imp.present_tense_plural_number, '' ]
18
+ meaning = { :meaning => MEANINGS[:active_voice_imperative_mood_present_tense] }
19
+ TenseBlock.new(elements, meaning)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,35 @@
1
+ module Linguistics
2
+ module Latin
3
+ module Verb
4
+ class LatinVerb
5
+ module Mutators
6
+ class Invariant
7
+ ##
8
+ #
9
+ # === GRAMMATICAL FUNCTION
10
+ #
11
+ # Action completed in the future.
12
+ # A&G,160,b,3.
13
+ #
14
+ ###
15
+ class ActiveVoiceIndicativeMoodFutureTenseStrategy
16
+ def initialize(verb)
17
+ @verb = verb
18
+ end
19
+
20
+ def apply!
21
+ @verb.instance_eval do
22
+ def active_voice_indicative_mood_futureperfect_tense
23
+ substem = first_person_perfect[0..-2]
24
+ return TenseBlock.new [APERF_FUTURE_ENDINGS.collect{|x| substem + x}].flatten,
25
+ { :meaning => MEANINGS[:active_voice_indicative_mood_futureperfect_tense] }
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,28 @@
1
+ module Linguistics
2
+ module Latin
3
+ module Verb
4
+ class LatinVerb
5
+ module Mutators
6
+ class Invariant
7
+ class ActiveVoiceIndicativeMoodFutureperfectTenseStrategy
8
+ def initialize(verb)
9
+ @verb = verb
10
+ end
11
+
12
+ def apply!
13
+ @verb.instance_eval do
14
+ def active_voice_indicative_mood_futureperfect_tense
15
+ substem = first_person_perfect[0..-2]
16
+ elements = APERF_FUTURE_ENDINGS.flat_map{|x| substem + x}
17
+ meaning = { :meaning => MEANINGS[:active_voice_indicative_mood_futureperfect_tense] }
18
+ TenseBlock.new(elements, meaning)
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,24 @@
1
+ module Linguistics
2
+ module Latin
3
+ module Verb
4
+ class LatinVerb
5
+ module Mutators
6
+ class Invariant
7
+ class ActiveVoiceIndicativeMoodImperfectTenseStrategy
8
+ def initialize(verb)
9
+ @verb = verb
10
+ end
11
+
12
+ def apply!
13
+ @verb.instance_eval do
14
+ def active_voice_indicative_mood_imperfect_tense
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,28 @@
1
+ module Linguistics
2
+ module Latin
3
+ module Verb
4
+ class LatinVerb
5
+ module Mutators
6
+ class Invariant
7
+ class ActiveVoiceIndicativeMoodPastperfectTenseStrategy
8
+ def initialize(verb)
9
+ @verb = verb
10
+ end
11
+
12
+ def apply!
13
+ @verb.instance_eval do
14
+ def active_voice_indicative_mood_pastperfect_tense
15
+ substem = first_person_perfect[0..-2]
16
+ elements = APERF_PAST_ENDINGS.flat_map{|x| substem + x}
17
+ meaning = { :meaning => MEANINGS[:active_voice_indicative_mood_pastperfect_tense] }
18
+ return TenseBlock.new(elements, meaning)
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,29 @@
1
+ module Linguistics
2
+ module Latin
3
+ module Verb
4
+ class LatinVerb
5
+ module Mutators
6
+ class Invariant
7
+ class ActiveVoiceIndicativeMoodPerfectTenseStrategy
8
+ def initialize(verb)
9
+ @verb = verb
10
+ end
11
+
12
+ def apply!
13
+ @verb.instance_eval do
14
+ def active_voice_indicative_mood_perfect_tense
15
+ substem = first_person_perfect[0..-2]
16
+ elements = APERF_ENDINGS.flat_map{|x| substem + x.to_s}
17
+ elements.unshift first_person_perfect
18
+ meaning = { :meaning => MEANINGS[:active_voice_indicative_mood_perfect_tense] }
19
+ return TenseBlock.new(elements, meaning)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,24 @@
1
+ module Linguistics
2
+ module Latin
3
+ module Verb
4
+ class LatinVerb
5
+ module Mutators
6
+ class Invariant
7
+ class ActiveVoiceIndicativeMoodPresentTenseStrategy
8
+ def initialize(verb)
9
+ @verb = verb
10
+ end
11
+
12
+ def apply!
13
+ @verb.instance_eval do
14
+ def active_voice_indicative_mood_present_tense
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,29 @@
1
+ module Linguistics
2
+ module Latin
3
+ module Verb
4
+ class LatinVerb
5
+ module Mutators
6
+ class Invariant
7
+ class ActiveVoiceSubjunctiveMoodImperfectTenseStrategy
8
+ def initialize(verb)
9
+ @verb = verb
10
+ end
11
+
12
+ def apply!
13
+ @verb.instance_eval do
14
+ def active_voice_subjunctive_mood_imperfect_tense
15
+ elements = [ 'm', *AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS ].flat_map do |ending|
16
+ present_active_infinitive.sub(/e$/,'ē') + ending
17
+ end
18
+ meaning = { :meaning => MEANINGS[:active_voice_subjunctive_mood_imperfect_tense] }
19
+ TenseBlock.new(elements, meaning)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,30 @@
1
+ module Linguistics
2
+ module Latin
3
+ module Verb
4
+ class LatinVerb
5
+ module Mutators
6
+ class Invariant
7
+ class ActiveVoiceSubjunctiveMoodPastperfectTenseStrategy
8
+ def initialize(verb)
9
+ @verb = verb
10
+ end
11
+
12
+ def apply!
13
+ @verb.instance_eval do
14
+ def active_voice_subjunctive_mood_pastperfect_tense
15
+ asp_base = first_person_perfect[0..first_person_perfect.length-2] + "issē"
16
+ elements = ['m', *AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS].flat_map do |ending|
17
+ asp_base + ending
18
+ end
19
+ meaning = { :meaning => MEANINGS[:active_voice_subjunctive_mood_pastperfect_tense] }
20
+ TenseBlock.new(elements, meaning)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,30 @@
1
+ module Linguistics
2
+ module Latin
3
+ module Verb
4
+ class LatinVerb
5
+ module Mutators
6
+ class Invariant
7
+ class ActiveVoiceSubjunctiveMoodPerfectTenseStrategy
8
+ def initialize(verb)
9
+ @verb = verb
10
+ end
11
+
12
+ def apply!
13
+ @verb.instance_eval do
14
+ def active_voice_subjunctive_mood_perfect_tense
15
+ asp_base = first_person_perfect[0..first_person_perfect.length-2] + "erī"
16
+ elements = ['m', *AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS].flat_map do |ending|
17
+ asp_base + ending
18
+ end
19
+ meaning = { :meaning => MEANINGS[:active_voice_subjunctive_mood_perfect_tense] }
20
+ TenseBlock.new(elements, meaning)
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,24 @@
1
+ module Linguistics
2
+ module Latin
3
+ module Verb
4
+ class LatinVerb
5
+ module Mutators
6
+ class Invariant
7
+ class ActiveVoiceSubjunctiveMoodPresentTenseStrategy
8
+ def initialize(verb)
9
+ @verb = verb
10
+ end
11
+
12
+ def apply!
13
+ @verb.instance_eval do
14
+ def active_voice_subjunctive_mood_present_tense
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,53 @@
1
+ module Linguistics
2
+ module Latin
3
+ module Verb
4
+ class LatinVerb
5
+ module Mutators
6
+ class Invariant
7
+ ##
8
+ #
9
+ # === GRAMMATICAL FUNCTION
10
+ #
11
+ # Used to express command. As A&G notes, oftentimes the Subjunctive
12
+ # is the correct mood for exhortation.
13
+ #
14
+ ###
15
+ class ImperativesStrategy
16
+ IMPERATIVE_EXCEPTIONS = {
17
+ "ducere" => %w(duc ducite),
18
+ "dicere" => %w(dic dicite),
19
+ "facere" => %w(fac facite),
20
+ "ferre" => %w(fer ferte),
21
+ "nolere" => %w(nolo nolite)
22
+ }
23
+
24
+ def initialize(verb)
25
+ @verb = verb
26
+ end
27
+
28
+ def apply!
29
+ args = exceptional_imperative? ? calculate_exceptional_imperatives : [@verb.stem, @verb.present_active_infinitive]
30
+ @verb.instance_eval do
31
+ def imperatives
32
+ Linguistics::Latin::Verb::ImperativeBlock.new(*args, self)
33
+ end
34
+ end
35
+ end
36
+
37
+
38
+ private
39
+
40
+ def exceptional_imperative?
41
+ IMPERATIVE_EXCEPTIONS.has_key?(present_active_infinitive)
42
+ end
43
+
44
+ def calculate_exceptional_imperatives
45
+ IMPERATIVE_EXCEPTIONS[present_active_infinitive]
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,24 @@
1
+ module Linguistics
2
+ module Latin
3
+ module Verb
4
+ class LatinVerb
5
+ module Mutators
6
+ class Invariant
7
+ class PassiveVoiceIndicativeMoodFutureTenseStrategy
8
+ def initialize(verb)
9
+ @verb = verb
10
+ end
11
+
12
+ def apply!
13
+ @verb.instance_eval do
14
+ def passive_voice_indicative_mood_future_tense
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,27 @@
1
+ module Linguistics
2
+ module Latin
3
+ module Verb
4
+ class LatinVerb
5
+ module Mutators
6
+ class Invariant
7
+ class PassiveVoiceIndicativeMoodFutureperfectTenseStrategy
8
+ def initialize(verb)
9
+ @verb = verb
10
+ end
11
+
12
+ def apply!
13
+ @verb.instance_eval do
14
+ def passive_voice_indicative_mood_futureperfect_tense
15
+ elements = PASS_PERF_FUTURE_ENDINGS.flat_map{ |helping_verb| "#{passive_perfect_participle} #{helping_verb}" }
16
+ meaning = { :meaning => MEANINGS[:passive_voice_indicative_mood_futureperfect_tense] }
17
+ return TenseBlock.new(elements, meaning)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end