latinverb 0.9.5 → 1.0.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -1
  3. data/Gemfile.lock +73 -28
  4. data/Rakefile +1 -7
  5. data/latinverb.gemspec +23 -4
  6. data/lib/latinverb/imperative_block/imperative_rule_factory.rb +1 -0
  7. data/lib/latinverb/imperative_block.rb +1 -2
  8. data/lib/latinverb/latinverb.rb +62 -0
  9. data/lib/latinverb/paradigmatic_verbs.rb +1 -0
  10. data/lib/latinverb/querent_mutators/deponent/infinitive_mutator.rb +24 -0
  11. data/lib/latinverb/querent_mutators/deponent/participle_mutator.rb +24 -0
  12. data/lib/latinverb/{tense_method_applicator/mutators/present_only.rb → querent_mutators/impersonal.rb} +5 -2
  13. data/lib/latinverb/querent_mutators/semideponent.rb +22 -0
  14. data/lib/latinverb/tense_block.rb +8 -7
  15. data/lib/latinverb/tense_block_names.rb +32 -0
  16. data/lib/latinverb/{components/validator.rb → validator.rb} +1 -3
  17. data/lib/latinverb/version.rb +1 -1
  18. data/lib/latinverb.rb +21 -77
  19. data/test/integration/ambiguous_lookups_test.rb +1 -7
  20. data/test/integration/cluster_resolution_test.rb +1 -7
  21. data/test/integration/data_structures_test.rb +2 -9
  22. data/test/integration/defect_semi_imp_test.rb +4 -10
  23. data/test/integration/deponent_first_conjugation_test.rb +7 -9
  24. data/test/integration/deponent_fourth_conjugation_test.rb +6 -9
  25. data/test/integration/deponent_second_conjugation_test.rb +12 -11
  26. data/test/integration/deponent_third_conjugation_test.rb +1 -9
  27. data/test/integration/deponent_third_io_conjugation_test.rb +6 -9
  28. data/test/integration/first_conjugation_test.rb +8 -14
  29. data/test/integration/fourth_conjugation_test.rb +7 -7
  30. data/test/integration/freakish_verb_test.rb +86 -0
  31. data/test/integration/freakish_vs.rb_test.rb +1 -1
  32. data/test/integration/imperative_block_test.rb +1 -9
  33. data/test/integration/irregular_sum_test.rb +1 -10
  34. data/test/integration/irregulars_test.rb +1 -10
  35. data/test/integration/macron_rules_test.rb +1 -8
  36. data/test/integration/second_conjugation_test.rb +8 -8
  37. data/test/integration/third_conjugation_test.rb +8 -6
  38. data/test/integration/third_io_conjugation_test.rb +6 -6
  39. metadata +262 -107
  40. data/lib/latinverb/components/chart_presenter.rb +0 -81
  41. data/lib/latinverb/components/classifier/strategies/defective_verb_classification_strategy.rb +0 -19
  42. data/lib/latinverb/components/classifier/strategies/deponent_verb_classification_strategy.rb +0 -19
  43. data/lib/latinverb/components/classifier/strategies/impersonal_verb_classification_strategy.rb +0 -19
  44. data/lib/latinverb/components/classifier/strategies/irregular_verb_classification_strategy.rb +0 -19
  45. data/lib/latinverb/components/classifier/strategies/present_only_verb_classification_strategy.rb +0 -21
  46. data/lib/latinverb/components/classifier/strategies/regular_verb_classification_strategy.rb +0 -19
  47. data/lib/latinverb/components/classifier/strategies/semideponent_verb_classification_strategy.rb +0 -19
  48. data/lib/latinverb/components/classifier/strategies/verb_classification_strategy.rb +0 -31
  49. data/lib/latinverb/components/classifier/strategies/very_irregular_verb_classification_strategy.rb +0 -20
  50. data/lib/latinverb/components/classifier.rb +0 -76
  51. data/lib/latinverb/components/imperatives_handler.rb +0 -40
  52. data/lib/latinverb/components/infinitivizer.rb +0 -50
  53. data/lib/latinverb/components/participler.rb +0 -58
  54. data/lib/latinverb/components/passive_infinitive_factory.rb +0 -42
  55. data/lib/latinverb/components/present_only_checker.rb +0 -32
  56. data/lib/latinverb/components/principal_parts_extractor.rb +0 -35
  57. data/lib/latinverb/components/stem_deriver.rb +0 -81
  58. data/lib/latinverb/components/type_evaluator.rb +0 -35
  59. data/lib/latinverb/components.rb +0 -9
  60. data/lib/latinverb/dynamic_method_resolver.rb +0 -41
  61. data/lib/latinverb/errors.rb +0 -10
  62. data/lib/latinverb/serialization/hash.rb +0 -17
  63. data/lib/latinverb/serialization/json.rb +0 -41
  64. data/lib/latinverb/serialization/yaml.rb +0 -15
  65. data/lib/latinverb/serialization.rb +0 -3
  66. data/lib/latinverb/tense_method_applicator/defective_checker.rb +0 -21
  67. data/lib/latinverb/tense_method_applicator/deponent_string_deriver.rb +0 -80
  68. data/lib/latinverb/tense_method_applicator/first_builder.rb +0 -98
  69. data/lib/latinverb/tense_method_applicator/fourth.rb +0 -100
  70. data/lib/latinverb/tense_method_applicator/fourth_builder.rb +0 -100
  71. data/lib/latinverb/tense_method_applicator/irregular_builder.rb +0 -117
  72. data/lib/latinverb/tense_method_applicator/mutator_for_classification_factory.rb +0 -38
  73. data/lib/latinverb/tense_method_applicator/mutator_for_verb_type.rb +0 -38
  74. data/lib/latinverb/tense_method_applicator/mutators/deponent/imperative_mutator.rb +0 -49
  75. data/lib/latinverb/tense_method_applicator/mutators/deponent/infinitive_mutator.rb +0 -42
  76. data/lib/latinverb/tense_method_applicator/mutators/deponent/participle_mutator.rb +0 -47
  77. data/lib/latinverb/tense_method_applicator/mutators/deponent/tense_block_mutator.rb +0 -55
  78. data/lib/latinverb/tense_method_applicator/mutators/deponent.rb +0 -41
  79. data/lib/latinverb/tense_method_applicator/mutators/impersonal.rb +0 -27
  80. data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_imperative_mood_future_tense_strategy.rb +0 -29
  81. data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_imperative_mood_present_tense_strategy.rb +0 -29
  82. data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_indicative_mood_future_tense_strategy.rb +0 -35
  83. data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_indicative_mood_futureperfect_tense_strategy.rb +0 -28
  84. data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_indicative_mood_imperfect_tense_strategy.rb +0 -24
  85. data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_indicative_mood_pastperfect_tense_strategy.rb +0 -28
  86. data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_indicative_mood_perfect_tense_strategy.rb +0 -29
  87. data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_indicative_mood_present_tense_strategy.rb +0 -24
  88. data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_subjunctive_mood_imperfect_tense_strategy.rb +0 -29
  89. data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_subjunctive_mood_pastperfect_tense_strategy.rb +0 -30
  90. data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_subjunctive_mood_perfect_tense_strategy.rb +0 -30
  91. data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_subjunctive_mood_present_tense_strategy.rb +0 -24
  92. data/lib/latinverb/tense_method_applicator/mutators/invariant/imperatives.rb +0 -53
  93. data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_indicative_mood_future_tense_strategy.rb +0 -24
  94. data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_indicative_mood_futureperfect_tense_strategy.rb +0 -27
  95. data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_indicative_mood_imperfect_tense_strategy.rb +0 -24
  96. data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_indicative_mood_pastperfect_tense_strategy.rb +0 -27
  97. data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_indicative_mood_perfect_tense_strategy.rb +0 -27
  98. data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_indicative_mood_present_tense_strategy.rb +0 -24
  99. data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_subjunctive_mood_imperfect_tense_strategy.rb +0 -30
  100. data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_subjunctive_mood_pastperfect_tense_strategy.rb +0 -33
  101. data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_subjunctive_mood_perfect_tense_strategy.rb +0 -33
  102. data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_subjunctive_mood_present_tense_strategy.rb +0 -24
  103. data/lib/latinverb/tense_method_applicator/mutators/invariant/triplicate_and_pluralize_formatters.rb +0 -26
  104. data/lib/latinverb/tense_method_applicator/mutators/invariant.rb +0 -65
  105. data/lib/latinverb/tense_method_applicator/mutators/irregular/infinitives_builder.rb +0 -35
  106. data/lib/latinverb/tense_method_applicator/mutators/irregular/json_deserializer.rb +0 -52
  107. data/lib/latinverb/tense_method_applicator/mutators/irregular/json_revivifier.rb +0 -48
  108. data/lib/latinverb/tense_method_applicator/mutators/irregular/participles_builder.rb +0 -35
  109. data/lib/latinverb/tense_method_applicator/mutators/irregular/present_only_irregular_mask.rb +0 -37
  110. data/lib/latinverb/tense_method_applicator/mutators/irregular.rb +0 -25
  111. data/lib/latinverb/tense_method_applicator/mutators/regular.rb +0 -17
  112. data/lib/latinverb/tense_method_applicator/mutators/semideponent.rb +0 -88
  113. data/lib/latinverb/tense_method_applicator/perfect_tense_remover.rb +0 -26
  114. data/lib/latinverb/tense_method_applicator/second_builder.rb +0 -105
  115. data/lib/latinverb/tense_method_applicator/tense_methods_vectorizer.rb +0 -73
  116. data/lib/latinverb/tense_method_applicator/third_builder.rb +0 -93
  117. data/lib/latinverb/tense_method_applicator/thirdio_builder.rb +0 -100
  118. data/lib/latinverb/tense_method_applicator.rb +0 -55
  119. data/test/integration/latin_verb_test.rb +0 -166
  120. data/test/unit/latinverb_accessible_reader_test.rb +0 -18
  121. data/test/unit/principal_parts_extractor_test.rb +0 -33
@@ -1,3 +0,0 @@
1
- require_relative './serialization/json'
2
- require_relative './serialization/yaml'
3
- require_relative './serialization/hash'
@@ -1,21 +0,0 @@
1
- module Linguistics
2
- module Latin
3
- module Verb
4
- class LatinVerb
5
- class DefectiveChecker
6
- extend Forwardable
7
- def_delegators :@verb, :first_person_singular, :present_active_infinitive
8
-
9
- def initialize(verb)
10
- @verb = verb
11
- end
12
-
13
- def defective?
14
- Linguistics::Latin::Verb::PRESENT_ONLY.member?(first_person_singular) ||
15
- Linguistics::Latin::Verb::PRESENT_ONLY.member?(present_active_infinitive)
16
- end
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,80 +0,0 @@
1
- module Linguistics
2
- module Latin
3
- module Verb
4
- class LatinVerb
5
- class DeponentStringDeriver
6
- ##
7
- #
8
- # Deponent verbs can be conceived as being the <em>the passive</em> results of
9
- # a regular verb where the passive form's result is then applied to the active
10
- # vector specification. Ergo the dictum "passive in form but active in
11
- # meaning." As such, when we realize we have a deponent verb, we will create
12
- # its standard four principal part string sibling. This, in turn, could be
13
- # used to create a LatinVerb. Then through some method deletion or aliasing,
14
- # the active vector can be used to point to the (in fact) passive result
15
- #
16
- # For example:
17
- #
18
- # <pre>
19
- # j = LatinVerb.new conor conārī conatus
20
- # # create_pseudo_active_mask_for_deponent creates (conō, conāre, conāvī
21
- # conatus)
22
- # # Do magic so that active_voice_indicative_mood_present_tense points to
23
- # passive_voice_indicative_mood_present_tense
24
- # </pre>
25
- #
26
- # ===ARGUMENTS
27
- #
28
- # s :: A deponent description string to be pesudo-mapped
29
- #
30
- # ===RETURNS
31
- #
32
- # A pseudo-mapped, four principal-part string
33
- #
34
- ##
35
-
36
- attr_reader :proxy_string
37
-
38
- def initialize(s)
39
- @original_string = s
40
- @proxy_string = create_pseudo_active_mask_for_deponent
41
- end
42
-
43
- private
44
-
45
- def create_pseudo_active_mask_for_deponent
46
- parts = @original_string.split( /\s+/ )
47
-
48
- # Turn the passive form into something that looks active
49
- parts[0].sub!( /or$/, 'ō' )
50
-
51
- # Turn the passive infinitive into something that looks active.
52
- # There's a subtle difference between:
53
- # 'vereor verērī veritum'
54
- # 'sequor sequī secūtus'
55
- # Applying the first's rule to the second results in 'seque' not
56
- # 'sequere'. Ergo the conditional.
57
- #
58
- parts[1] ||= ""
59
- parts[1].sub!( /ī$/, 'e' )
60
-
61
- # Fixes sequī -> sequere
62
- parts[1] += 're' unless parts[1] =~ /[āīē]re/
63
-
64
- # Set the 4th part to the value in the 3rd slot
65
- parts[3] = parts[2]
66
-
67
- # Another modification for third conjugation deponents
68
- parts[3] ||= ""
69
- parts[3].sub!( /us$/, 'um' )
70
-
71
- # This value shouldn't be used
72
- parts[2] = "PreventDeponentInfiniteRegress"
73
-
74
- parts.join(' ')
75
- end
76
- end
77
- end
78
- end
79
- end
80
- end
@@ -1,98 +0,0 @@
1
- module Linguistics
2
- module Latin
3
- module Verb
4
- class LatinVerb
5
- class TenseMethodApplicator
6
- class MutatorForVerbType
7
- class FirstBuilder
8
- def initialize(verb)
9
- @verb = verb
10
- end
11
-
12
- def build!
13
- @verb.instance_eval do
14
- def active_voice_indicative_mood_future_tense
15
- return TenseBlock.new(
16
- [AF_ONE_TWO_ENDINGS.collect{|x| stem + x}].flatten,
17
- { :meaning => MEANINGS[:active_voice_indicative_mood_future_tense] }
18
- )
19
- end
20
-
21
- def active_voice_indicative_mood_imperfect_tense
22
- return TenseBlock.new(
23
- [AI_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS.collect{|x| stem + x}].flatten,
24
- { :meaning => MEANINGS[:active_voice_indicative_mood_imperfect_tense] }
25
- )
26
- end
27
-
28
- def active_voice_indicative_mood_present_tense
29
- return TenseBlock.new(
30
- [ first_person_singular, AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS.collect{ |ending| stem + ending} ].flatten,
31
- { :meaning => MEANINGS[:active_voice_indicative_mood_present_tense] }
32
- )
33
- end
34
-
35
- def active_voice_subjunctive_mood_present_tense
36
- key = verb_type.ordinal_name_key
37
- asp_base = stem[0..-2] + ACTIVE_PRESENT_SUBJUNCTIVE_ENDINGS[key]
38
- endings_coll = ['m', AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS].flatten!
39
- collection = endings_coll.map{ |ending| asp_base + ending }
40
- TenseBlock.new(
41
- collection,
42
- { :meaning => Linguistics::Latin::Verb::MEANINGS[:active_voice_subjunctive_mood_present_tense] }
43
- )
44
- end
45
-
46
- def passive_voice_indicative_mood_future_tense
47
- fp_stem = stem + "bi"
48
- standards = PASSIVE_ENDINGS_FIRST_AND_SECOND_CONJG[2..-1].map{|x| fp_stem + x}
49
- standards.pop
50
- fp_stem.sub!(/.$/,'u')
51
- collection =
52
- [ stem + "b\xc5\x8dr",
53
- stem + "beris",
54
- standards,
55
- fp_stem + PASSIVE_ENDINGS_FIRST_AND_SECOND_CONJG.last].flatten!
56
-
57
- TenseBlock.new(
58
- collection,
59
- { :meaning => MEANINGS[:passive_voice_indicative_mood_future_tense] }
60
- )
61
- end
62
-
63
- def passive_voice_indicative_mood_imperfect_tense
64
- imperfect_stem = stem + "b\xc4\x81"
65
- collection = PASSIVE_ENDINGS_FIRST_AND_SECOND_CONJG.map{|x| imperfect_stem + x}
66
- return TenseBlock.new(
67
- collection,
68
- { :meaning => MEANINGS[:passive_voice_indicative_mood_imperfect_tense] }
69
- )
70
- end
71
-
72
- def passive_voice_indicative_mood_present_tense
73
- local_pe = PASSIVE_ENDINGS_FIRST_AND_SECOND_CONJG.clone
74
- collection = [first_person_singular.to_s + "r", local_pe[1..-1].map{|x| stem + x}].flatten
75
- return TenseBlock.new(
76
- collection,
77
- { :meaning => MEANINGS[:passive_voice_indicative_mood_present_tense] }
78
- )
79
- end
80
-
81
- def passive_voice_subjunctive_mood_present_tense
82
- key = verb_type.ordinal_name_key
83
- short_base = stem[0..-2] + ACTIVE_PRESENT_SUBJUNCTIVE_ENDINGS[key]
84
- collection = PASSIVE_ENDINGS_FIRST_AND_SECOND_CONJG.map { |ending| short_base + ending }
85
- TenseBlock.new(
86
- collection,
87
- { :meaning => MEANINGS[:passive_voice_subjunctive_mood_present_tense] }
88
- )
89
- end
90
- end
91
- end
92
- end
93
- end
94
- end
95
- end
96
- end
97
- end
98
- end
@@ -1,100 +0,0 @@
1
- module Linguistics
2
- module Latin
3
- module Verb
4
- class LatinVerb
5
- class TenseMethodApplicator
6
- class MutatorForVerbType
7
- class ThirdIOBuilder
8
- def initialize(verb)
9
- @verb = verb
10
- end
11
-
12
- def build!
13
- @verb.instance_eval do
14
- def active_voice_indicative_mood_future_tense
15
- return TenseBlock.new(
16
- [AF_OTHER_ENDINGS.collect{|x| stem + "i" + x}].flatten,
17
- { :meaning => MEANINGS[:active_voice_indicative_mood_future_tense] }
18
- )
19
- end
20
-
21
- def active_voice_indicative_mood_imperfect_tense
22
- return TenseBlock.new(
23
- [AI_THIRD_CONJUG_PERS_ENDINGS.collect do |x|
24
- stem + "i" + x end ].flatten!,
25
- { :meaning => MEANINGS[:active_voice_indicative_mood_imperfect_tense] }
26
- )
27
- end
28
-
29
- def active_voice_indicative_mood_present_tense
30
- return TenseBlock.new(
31
- [ first_person_singular,
32
- AP_THIRDIO_CONJG_PERS_ENDINGS.collect{ |ending| stem + ending }
33
- ].flatten!,
34
- { :meaning => MEANINGS[:active_voice_indicative_mood_present_tense] }
35
- )
36
- end
37
-
38
- def active_voice_subjunctive_mood_present_tense
39
- key = verb_type.ordinal_name_key
40
- asp_base = stem[0..-1] + ACTIVE_PRESENT_SUBJUNCTIVE_ENDINGS[key]
41
- elems = ['m',
42
- AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS].flatten!.map do |ending|
43
- asp_base + ending
44
- end
45
-
46
- TenseBlock.new(
47
- elems,
48
- { :meaning => MEANINGS[:active_voice_subjunctive_mood_present_tense] }
49
- )
50
- end
51
-
52
- def passive_voice_indicative_mood_future_tense
53
- ie_base = stem + "iē"
54
- elems = [stem + "ia" + PASSIVE_ENDINGS_FIRST_AND_SECOND_CONJG[0],
55
- PASSIVE_ENDINGS_FIRST_AND_SECOND_CONJG[1..-1].map{|x| ie_base + x}].flatten!
56
- TenseBlock.new(
57
- elems,
58
- { :meaning => MEANINGS[:passive_voice_indicative_mood_future_tense] }
59
- )
60
- end
61
-
62
- def passive_voice_indicative_mood_imperfect_tense
63
- base = stem + "iēbā"
64
- elems = [PASSIVE_ENDINGS_FIRST_AND_SECOND_CONJG.map{|x| base + x}].flatten!
65
- return TenseBlock.new(
66
- elems,
67
- { :meaning => MEANINGS[:passive_voice_indicative_mood_imperfect_tense] }
68
- )
69
- end
70
-
71
- def passive_voice_indicative_mood_present_tense
72
- base = stem + "ī"
73
- elems = [first_person_singular + "r",
74
- PASSIVE_ENDINGS_FIRST_AND_SECOND_CONJG[1..-2].map{|x| base + x},
75
- base + PASSIVE_ENDINGS_OTHER[-1]].flatten!
76
- return TenseBlock.new(
77
- elems,
78
- { :meaning => MEANINGS[:passive_voice_indicative_mood_present_tense] }
79
- )
80
- end
81
-
82
- def passive_voice_subjunctive_mood_present_tense
83
- subjunctive_stem = stem + "iā"
84
- elems = PASSIVE_ENDINGS_FIRST_AND_SECOND_CONJG.map do |ending|
85
- subjunctive_stem + ending
86
- end
87
- TenseBlock.new(
88
- elems,
89
- { :meaning => MEANINGS[:passive_voice_subjunctive_mood_present_tense] }
90
- )
91
- end
92
- end
93
- end
94
- end
95
- end
96
- end
97
- end
98
- end
99
- end
100
- end
@@ -1,100 +0,0 @@
1
- module Linguistics
2
- module Latin
3
- module Verb
4
- class LatinVerb
5
- class TenseMethodApplicator
6
- class MutatorForVerbType
7
- class FourthBuilder
8
- def initialize(verb)
9
- @verb = verb
10
- end
11
-
12
- def build!
13
- @verb.instance_eval do
14
- def active_voice_indicative_mood_future_tense
15
- return TenseBlock.new(
16
- [AF_OTHER_ENDINGS.collect{|x| stem + "i" + x}].flatten,
17
- { :meaning => MEANINGS[:active_voice_indicative_mood_future_tense] }
18
- )
19
- end
20
-
21
- def active_voice_indicative_mood_imperfect_tense
22
- return TenseBlock.new(
23
- [AI_THIRD_CONJUG_PERS_ENDINGS.collect do |x|
24
- stem + "i" + x end ].flatten,
25
- { :meaning => MEANINGS[:active_voice_indicative_mood_imperfect_tense] }
26
- )
27
- end
28
-
29
- def active_voice_indicative_mood_present_tense
30
- return TenseBlock.new(
31
- [ first_person_singular,
32
- AP_THIRDIO_CONJG_PERS_ENDINGS.collect{ |ending| stem + ending }
33
- ].flatten,
34
- { :meaning => MEANINGS[:active_voice_indicative_mood_present_tense] }
35
- )
36
- end
37
-
38
- def active_voice_subjunctive_mood_present_tense
39
- key = verb_type.ordinal_name_key
40
- asp_base = stem[0..-1] + ACTIVE_PRESENT_SUBJUNCTIVE_ENDINGS[key]
41
- collection = ['m',
42
- AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS].flatten.map do |ending|
43
- asp_base + ending
44
- end
45
-
46
- TenseBlock.new(
47
- collection,
48
- { :meaning => MEANINGS[:active_voice_subjunctive_mood_present_tense] }
49
- )
50
- end
51
-
52
- def passive_voice_indicative_mood_future_tense
53
- ie_base = stem + "iē"
54
- collection = [stem + "ia" + PASSIVE_ENDINGS_FIRST_AND_SECOND_CONJG[0],
55
- PASSIVE_ENDINGS_FIRST_AND_SECOND_CONJG[1..-1].map{|x| ie_base + x}].flatten
56
- TenseBlock.new(
57
- collection,
58
- { :meaning => MEANINGS[:passive_voice_indicative_mood_future_tense] }
59
- )
60
- end
61
-
62
- def passive_voice_indicative_mood_imperfect_tense
63
- base = stem + "iēbā"
64
- collection = [PASSIVE_ENDINGS_FIRST_AND_SECOND_CONJG.map{|x| base + x}].flatten
65
- return TenseBlock.new(
66
- collection,
67
- { :meaning => MEANINGS[:passive_voice_indicative_mood_imperfect_tense] }
68
- )
69
- end
70
-
71
- def passive_voice_indicative_mood_present_tense
72
- base = stem + "ī"
73
- collection = [first_person_singular + "r",
74
- PASSIVE_ENDINGS_FIRST_AND_SECOND_CONJG[1..-2].map{|x| base + x},
75
- base + PASSIVE_ENDINGS_OTHER[-1]].flatten
76
- return TenseBlock.new(
77
- collection,
78
- { :meaning => MEANINGS[:passive_voice_indicative_mood_present_tense] }
79
- )
80
- end
81
-
82
- def passive_voice_subjunctive_mood_present_tense
83
- subjunctive_stem = stem + "iā"
84
- collection = PASSIVE_ENDINGS_FIRST_AND_SECOND_CONJG.map do |ending|
85
- subjunctive_stem + ending
86
- end
87
- TenseBlock.new(
88
- collection,
89
- { :meaning => MEANINGS[:passive_voice_subjunctive_mood_present_tense] }
90
- )
91
- end
92
- end
93
- end
94
- end
95
- end
96
- end
97
- end
98
- end
99
- end
100
- end
@@ -1,117 +0,0 @@
1
- module Linguistics
2
- module Latin
3
- module Verb
4
- class LatinVerb
5
- class TenseMethodApplicator
6
- class MutatorForVerbType
7
- class IrregularBuilder
8
- extend Forwardable
9
- def_delegators :@verb, :original_string, :classified_as
10
-
11
- def initialize(verb)
12
- @verb = verb
13
- end
14
-
15
- def build!
16
- if classified_as.impersonal?
17
- impersonal_builder
18
- else
19
- irregular_from_stored_definition
20
- end
21
- end
22
-
23
- private
24
-
25
- def impersonal_builder
26
- @verb.instance_eval do
27
- def active_voice_indicative_mood_present_tense
28
- TenseBlock.new ["", "", @original_string,
29
- "", "", ""]
30
- end
31
-
32
- def active_voice_indicative_mood_present_tense_third_person_singular_number
33
- return active_voice_indicative_mood_present_tense[2]
34
- end
35
- end
36
- end
37
-
38
- def irregular_from_stored_definition
39
- validate(serialized_verb = find_serialized_irregular_verb)
40
- revivify!(serialized_verb)
41
-
42
- rescue => error
43
- warn "#{original_string} was identified as irregular but did not have a definition provided."
44
- raise error
45
- end
46
-
47
- def find_serialized_irregular_verb
48
- Linguistics::Latin::Verb.const_get(serialized_irregular_verb_lookup_key)
49
- rescue NameError => e
50
- puts "Unable to find a definition for #{original_string}. Please provide one."
51
- raise e
52
- end
53
-
54
-
55
- def validate(serialized_verb)
56
- raise "Found a JSON string with null length!" if serialized_verb.length <= 10
57
- end
58
-
59
- def revivify!(serialized_verb)
60
- revivified_data_structure = JSON.load(serialized_verb)
61
- revivified_data_structure['tense_blocks'].each_pair do |k,v|
62
- singleton_class.class_eval do
63
- define_method k.to_sym do
64
- TenseBlock.new v, { :meaning => MEANINGS[k.to_sym] }
65
- end
66
- end
67
- end
68
-
69
- @verb.instance_eval do
70
- irregular_infinitives = revivified_data_structure['infinitives']
71
- irregular_participles = revivified_data_structure['participles']
72
- end
73
-
74
- return if @irregular_infinitives.nil?
75
- return if @irregular_participles.nil?
76
-
77
- @verb.instance_eval do
78
- def present_active_infinitive; return @irregular_infinitives.present_active_infinitive; end
79
- def present_passive_infinitive; return @irregular_infinitives.present_passive_infinitive; end
80
- def perfect_active_infinitive; return @irregular_infinitives.perfect_active_infinitive; end
81
- def perfect_passive_infinitive; return @irregular_infinitives.perfect_passive_infinitive; end
82
- def future_passive_infinitive; return @irregular_infinitives.future_passive_infinitive; end
83
- def future_active_infinitive; return @irregular_infinitives.future_active_infinitive; end
84
- end
85
-
86
- @verb.instance_eval do
87
- def present_active_participle; return @irregular_participles.present_active_participle; end
88
- def future_active_participle; return @irregular_participles.future_active_participle; end
89
- def perfect_passive_participle; return @irregular_participles.perfect_passive_participle; end
90
- def future_passive_participle; return @irregular_participles.future_passive_participle; end
91
- def gerundive; return @irregular_participles.gerundive; end
92
- def gerund; return @irregular_participles.d; end
93
- end
94
-
95
- rescue JSON::ParserError => e
96
- puts "Unable to parse JSON for #{original_string} [o:#{o}] [o_sym:#{o_upcase_and_symbolic}]. Please verify your syntax."
97
- raise e
98
- end
99
-
100
- def serialized_irregular_verb_lookup_key
101
- o = ActiveSupport::Multibyte::Chars.new( original_string.gsub(/\s+/,'_') ).upcase
102
-
103
- if o.match(/^([ĀĒĪŌŪ])(.*)/)
104
- x = o[0,1].tr 'ĀĒĪŌŪ', 'AEIOU'
105
- y = o[1,o.length]
106
- o = x + y
107
- end
108
-
109
- o.to_sym
110
- end
111
- end
112
- end
113
- end
114
- end
115
- end
116
- end
117
- end
@@ -1,38 +0,0 @@
1
- require_relative './mutator_for_verb_type'
2
- require_relative './mutators/deponent'
3
- require_relative './mutators/impersonal'
4
- require_relative './mutators/invariant'
5
- require_relative './mutators/irregular'
6
- require_relative './mutators/present_only'
7
- require_relative './mutators/regular'
8
- require_relative './mutators/semideponent'
9
-
10
- module Linguistics
11
- module Latin
12
- module Verb
13
- class LatinVerb
14
- class TenseMethodApplicator
15
- class MutatorForClassificationFactory
16
- MAPPING = {
17
- Impersonal: Mutators::Impersonal,
18
- PresentOnly: Mutators::PresentOnly,
19
- Irregular: Mutators::Irregular,
20
- Deponent: Mutators::Deponent,
21
- Semideponent: Mutators::Semideponent,
22
- Regular: Mutators::Regular
23
- }
24
-
25
- def initialize(verb)
26
- @verb = verb
27
- @classification = verb.classification
28
- end
29
-
30
- def mutator
31
- MAPPING[@classification.short_name_key].new(@verb)
32
- end
33
- end
34
- end
35
- end
36
- end
37
- end
38
- end
@@ -1,38 +0,0 @@
1
- require_relative './first_builder'
2
- require_relative './second_builder'
3
- require_relative './third_builder'
4
- require_relative './thirdio_builder'
5
- require_relative './fourth_builder'
6
- require_relative './irregular_builder'
7
-
8
- module Linguistics
9
- module Latin
10
- module Verb
11
- class LatinVerb
12
- class TenseMethodApplicator
13
- class MutatorForVerbType
14
- extend Forwardable
15
- def_delegators :@verb, :verb_type
16
-
17
- MAPPING = {
18
- First: FirstBuilder,
19
- Second: SecondBuilder,
20
- ThirdIO: ThirdIOBuilder,
21
- Third: ThirdBuilder,
22
- Fourth: FourthBuilder,
23
- Irregular: IrregularBuilder
24
- }
25
-
26
- def initialize(verb)
27
- @verb = verb
28
- end
29
-
30
- def mutate!
31
- MAPPING[verb_type.ordinal_name_key].new(@verb).build!
32
- end
33
- end
34
- end
35
- end
36
- end
37
- end
38
- end
@@ -1,49 +0,0 @@
1
- module Linguistics
2
- module Latin
3
- module Verb
4
- class LatinVerb
5
- module Mutators
6
- class Deponent
7
- class ImperativeMutator
8
- def initialize(verb, proxyVerb)
9
- @verb =verb
10
- @proxyVerb = proxyVerb
11
- mutate!
12
- end
13
-
14
- ##
15
- #
16
- # The deponent's imperatives require a bit of consideration. They don't
17
- # follow the stem/stem+'ite' format.
18
- #
19
- ##
20
-
21
- def mutate!
22
- proxyVerb = @proxyVerb
23
- @verb.instance_eval do
24
- extend Linguistics::Latin::Phonographia
25
- @proxyVerb = proxyVerb
26
-
27
- def active_voice_imperative_mood_present_tense_second_person_singular_number
28
- @proxyVerb.send(:present_active_infinitive)
29
- end
30
-
31
- def active_voice_imperative_mood_present_tense_second_person_plural_number
32
- return @proxyVerb.send :passive_voice_indicative_mood_present_tense_second_person_plural_number
33
- end
34
-
35
- def active_voice_imperative_mood_future_tense_second_person_singular_number
36
- k = @proxyVerb.send :passive_voice_indicative_mood_present_tense_second_person_plural_number
37
- k.sub!(/minī$/, '')
38
- k += 'tor'
39
- fix_macrons k
40
- end
41
- end
42
- end
43
- end
44
- end
45
- end
46
- end
47
- end
48
- end
49
- end