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,24 +0,0 @@
1
- module Linguistics
2
- module Latin
3
- module Verb
4
- class LatinVerb
5
- module Mutators
6
- class Invariant
7
- class PassiveVoiceIndicativeMoodImperfectTenseStrategy
8
- def initialize(verb)
9
- @verb = verb
10
- end
11
-
12
- def apply!
13
- @verb.instance_eval do
14
- def passive_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
@@ -1,27 +0,0 @@
1
- module Linguistics
2
- module Latin
3
- module Verb
4
- class LatinVerb
5
- module Mutators
6
- class Invariant
7
- class PassiveVoiceIndicativeMoodPastperfectTenseStrategy
8
- def initialize(verb)
9
- @verb = verb
10
- end
11
-
12
- def apply!
13
- @verb.instance_eval do
14
- def passive_voice_indicative_mood_pastperfect_tense
15
- elements = Linguistics::Latin::Verb::PASS_PERF_PAST_ENDINGS.map{ |helping_verb| "#{passive_perfect_participle} #{helping_verb}" }
16
- meaning = { :meaning => Linguistics::Latin::Verb::MEANINGS[:passive_voice_indicative_mood_pastperfect_tense]}
17
- TenseBlock.new(elements, meaning)
18
- end
19
- end
20
- end
21
- end
22
- end
23
- end
24
- end
25
- end
26
- end
27
- end
@@ -1,27 +0,0 @@
1
- module Linguistics
2
- module Latin
3
- module Verb
4
- class LatinVerb
5
- module Mutators
6
- class Invariant
7
- class PassiveVoiceIndicativeMoodPerfectTenseStrategy
8
- def initialize(verb)
9
- @verb = verb
10
- end
11
-
12
- def apply!
13
- @verb.instance_eval do
14
- def passive_voice_indicative_mood_perfect_tense
15
- elements = PASS_PERF_PRESENT_ENDINGS.map{ |helping_verb| "#{passive_perfect_participle} #{helping_verb}" }
16
- meaning = { :meaning => MEANINGS[:passive_voice_indicative_mood_perfect_tense] }
17
- TenseBlock.new(elements, meaning )
18
- end
19
- end
20
- end
21
- end
22
- end
23
- end
24
- end
25
- end
26
- end
27
- end
@@ -1,24 +0,0 @@
1
- module Linguistics
2
- module Latin
3
- module Verb
4
- class LatinVerb
5
- module Mutators
6
- class Invariant
7
- class PassiveVoiceIndicativeMoodPresentTenseStrategy
8
- def initialize(verb)
9
- @verb = verb
10
- end
11
-
12
- def apply!
13
- @verb.instance_eval do
14
- def passive_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
@@ -1,30 +0,0 @@
1
- module Linguistics
2
- module Latin
3
- module Verb
4
- class LatinVerb
5
- module Mutators
6
- class Invariant
7
- class PassiveVoiceSubjunctiveMoodImperfectTenseStrategy
8
- def initialize(verb)
9
- @verb = verb
10
- end
11
-
12
- def apply!
13
- @verb.instance_eval do
14
- def passive_voice_subjunctive_mood_imperfect_tense
15
- base = present_active_infinitive.gsub(/(.*)(.)$/,"\\1" + 'ē')
16
- elements = PASSIVE_ENDINGS_FIRST_AND_SECOND_CONJG.map do |ending|
17
- base + ending
18
- end
19
- meaning = { :meaning => Linguistics::Latin::Verb::MEANINGS[:passive_voice_subjunctive_mood_imperfect_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
@@ -1,33 +0,0 @@
1
- module Linguistics
2
- module Latin
3
- module Verb
4
- class LatinVerb
5
- module Mutators
6
- class Invariant
7
- class PassiveVoiceSubjunctiveMoodPastperfectTenseStrategy
8
- def initialize(verb)
9
- @verb = verb
10
- end
11
-
12
- def apply!
13
- @verb.instance_eval do
14
- def passive_voice_subjunctive_mood_pastperfect_tense
15
- count = -1
16
- elements = PASS_PLUPERF_PAST_ENDINGS.map do |ending|
17
- count += 1
18
- (count <= 2 ?
19
- "[ #{TriplicateAndPluralizeFormatters.triplicate_and_genderize(passive_perfect_participle)} ]" :
20
- "[ #{TriplicateAndPluralizeFormatters.pluralize_participial_listing(passive_perfect_participle)} ]" )+ " " + ending
21
- end
22
- meaning = { :meaning => Linguistics::Latin::Verb::MEANINGS[:passive_voice_subjunctive_mood_pastperfect_tense] }
23
- TenseBlock.new(elements, meaning)
24
- end
25
- end
26
- end
27
- end
28
- end
29
- end
30
- end
31
- end
32
- end
33
- end
@@ -1,33 +0,0 @@
1
- module Linguistics
2
- module Latin
3
- module Verb
4
- class LatinVerb
5
- module Mutators
6
- class Invariant
7
- class PassiveVoiceSubjunctiveMoodPerfectTenseStrategy
8
- def initialize(verb)
9
- @verb = verb
10
- end
11
-
12
- def apply!
13
- @verb.instance_eval do
14
- def passive_voice_subjunctive_mood_perfect_tense
15
- counter = -1
16
- elements = PASS_PERF_SUBJUNCTIVE_ENDINGS.map do |ending|
17
- counter += 1
18
- (counter <= 2 ?
19
- "[ #{TriplicateAndPluralizeFormatters.triplicate_and_genderize(passive_perfect_participle)} ]" :
20
- "[ #{TriplicateAndPluralizeFormatters.pluralize_participial_listing(passive_perfect_participle)} ]" )+ " " + ending
21
- end
22
- meaning = { :meaning => Linguistics::Latin::Verb::MEANINGS[:passive_voice_subjunctive_mood_perfect_tense] }
23
- TenseBlock.new(elements, meaning)
24
- end
25
- end
26
- end
27
- end
28
- end
29
- end
30
- end
31
- end
32
- end
33
- end
@@ -1,24 +0,0 @@
1
- module Linguistics
2
- module Latin
3
- module Verb
4
- class LatinVerb
5
- module Mutators
6
- class Invariant
7
- class PassiveVoiceSubjunctiveMoodPresentTenseStrategy
8
- def initialize(verb)
9
- @verb = verb
10
- end
11
-
12
- def apply!
13
- @verb.instance_eval do
14
- def passive_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
@@ -1,26 +0,0 @@
1
- module Linguistics
2
- module Latin
3
- module Verb
4
- class LatinVerb
5
- module Mutators
6
- class TriplicateAndPluralizeFormatters
7
- def self.pluralize_participial_listing(participle)
8
- x = triplicate_and_genderize(participle)
9
- x.sub!(/us,/, 'ī,' )
10
- x.sub!(/a,/, 'ae,')
11
- x.sub!(/um.*$/, 'a' )
12
- end
13
-
14
- def self.triplicate_and_genderize(s)
15
- stem = s.sub(/^(.*)um$/,"\\1")
16
- [ stem + 'us',
17
- stem + 'a',
18
- s
19
- ].join(', ')
20
- end
21
- end
22
- end
23
- end
24
- end
25
- end
26
- end
@@ -1,65 +0,0 @@
1
- require_relative './invariant/triplicate_and_pluralize_formatters'
2
- require_relative './invariant/active_voice_imperative_mood_future_tense_strategy'
3
- require_relative './invariant/active_voice_imperative_mood_present_tense_strategy'
4
- require_relative './invariant/active_voice_indicative_mood_futureperfect_tense_strategy'
5
- require_relative './invariant/active_voice_indicative_mood_future_tense_strategy'
6
- require_relative './invariant/active_voice_indicative_mood_imperfect_tense_strategy'
7
- require_relative './invariant/active_voice_indicative_mood_pastperfect_tense_strategy'
8
- require_relative './invariant/active_voice_indicative_mood_perfect_tense_strategy'
9
- require_relative './invariant/active_voice_indicative_mood_present_tense_strategy'
10
- require_relative './invariant/active_voice_subjunctive_mood_imperfect_tense_strategy'
11
- require_relative './invariant/active_voice_subjunctive_mood_pastperfect_tense_strategy'
12
- require_relative './invariant/active_voice_subjunctive_mood_perfect_tense_strategy'
13
- require_relative './invariant/active_voice_subjunctive_mood_present_tense_strategy'
14
- require_relative './invariant/passive_voice_indicative_mood_futureperfect_tense_strategy'
15
- require_relative './invariant/passive_voice_indicative_mood_future_tense_strategy'
16
- require_relative './invariant/passive_voice_indicative_mood_imperfect_tense_strategy'
17
- require_relative './invariant/passive_voice_indicative_mood_pastperfect_tense_strategy'
18
- require_relative './invariant/passive_voice_indicative_mood_perfect_tense_strategy'
19
- require_relative './invariant/passive_voice_indicative_mood_present_tense_strategy'
20
- require_relative './invariant/passive_voice_subjunctive_mood_imperfect_tense_strategy'
21
- require_relative './invariant/passive_voice_subjunctive_mood_pastperfect_tense_strategy'
22
- require_relative './invariant/passive_voice_subjunctive_mood_perfect_tense_strategy'
23
- require_relative './invariant/passive_voice_subjunctive_mood_present_tense_strategy'
24
- require_relative './invariant/imperatives'
25
-
26
- module Linguistics
27
- module Latin
28
- module Verb
29
- class LatinVerb
30
- module Mutators
31
- class Invariant
32
-
33
- STRATEGIES = [
34
- ActiveVoiceImperativeMoodPresentTenseStrategy,
35
- ActiveVoiceImperativeMoodFutureTenseStrategy,
36
- ActiveVoiceIndicativeMoodFutureTenseStrategy,
37
- ActiveVoiceIndicativeMoodPastperfectTenseStrategy,
38
- ActiveVoiceIndicativeMoodPerfectTenseStrategy,
39
- ActiveVoiceSubjunctiveMoodImperfectTenseStrategy,
40
- ActiveVoiceSubjunctiveMoodPastperfectTenseStrategy,
41
- ActiveVoiceSubjunctiveMoodPerfectTenseStrategy,
42
- PassiveVoiceIndicativeMoodFutureperfectTenseStrategy,
43
- PassiveVoiceIndicativeMoodPastperfectTenseStrategy,
44
- PassiveVoiceIndicativeMoodPerfectTenseStrategy,
45
- PassiveVoiceSubjunctiveMoodImperfectTenseStrategy,
46
- PassiveVoiceSubjunctiveMoodPastperfectTenseStrategy,
47
- PassiveVoiceSubjunctiveMoodPerfectTenseStrategy,
48
- ]
49
-
50
- def initialize(verb)
51
- @verb = verb
52
- apply_strategies!
53
- end
54
-
55
- def apply_strategies!
56
- STRATEGIES.each do |strategy|
57
- strategy.new(@verb).apply!
58
- end
59
- end
60
- end
61
- end
62
- end
63
- end
64
- end
65
- end
@@ -1,35 +0,0 @@
1
- module Linguistics
2
- module Latin
3
- module Verb
4
- class LatinVerb
5
- module Mutators
6
- class Irregular
7
- class Revivifier
8
- class InfinitivesBuilder
9
- def initialize(verb, infinitives_structure)
10
- @verb = verb
11
- @infinitives_structure = infinitives_structure
12
- mutate!
13
- end
14
-
15
- def mutate!
16
- i = OpenStruct.new(@infinitives_structure)
17
-
18
- @verb.instance_exec do
19
- @_infinitives = i
20
- def present_active_infinitive; @_infinitives.present_active_infinitive; end
21
- def present_passive_infinitive; @_infinitives.present_passive_infinitive; end
22
- def perfect_active_infinitive; @_infinitives.perfect_active_infinitive; end
23
- def perfect_passive_infinitive; @_infinitives.perfect_passive_infinitive; end
24
- def future_passive_infinitive; @_infinitives.future_passive_infinitive; end
25
- def future_active_infinitive; @_infinitives.future_active_infinitive; end
26
- end
27
- end
28
- end
29
- end
30
- end
31
- end
32
- end
33
- end
34
- end
35
- end
@@ -1,52 +0,0 @@
1
- module Linguistics
2
- module Latin
3
- module Verb
4
- class LatinVerb
5
- module Mutators
6
- class Irregular
7
- class Deserializer
8
- attr_reader :revivified_data_structure
9
-
10
- def initialize(verb)
11
- @verb = verb
12
- json_string = Linguistics::Latin::Verb.const_get(symbolize_original_string)
13
- raise "Found a JSON string with an absurdly small length!" if json_string.length <= 10
14
- @revivified_data_structure = JSON.parse( json_string )
15
- rescue JSON::ParserError => e
16
- puts "We were unable to parse JSON for #{@verb.original_string} [o:#{o}] [o_sym:#{o_upcase_and_symbolic}]. Please verify your syntax."
17
- raise e
18
- rescue NameError => e
19
- puts "We were unable to find a definition for #{@verb.original_string}"
20
- raise e
21
- rescue => e
22
- warn "#{@verb.original_string} was identified as irregular but did not have a definition provided."
23
- raise e
24
- end
25
-
26
- private
27
-
28
- def symbolize_original_string
29
- # Translation added to account for Ruby not liking constants /^/
30
- # with a multibyte. Probably a bug.
31
- #
32
- # This bug can be discovered by running #constants on
33
- # Linguistics::Latin::Verb and seeing that Ōxxx is not found. To
34
- # fix this i had to store it as ODI_. To make /that/ hack work, I
35
- # had to add this bit beginning two lines below :-/
36
- o = ActiveSupport::Multibyte::Chars.new( @verb.original_string.gsub(/\s+/,'_') ).upcase
37
-
38
- if o.match(/^([ĀĒĪŌŪ])(.*)/)
39
- x=o[0,1].tr 'ĀĒĪŌŪ', 'AEIOU'
40
- y=o[1,o.length]
41
- o= x + y
42
- end
43
-
44
- o.to_sym
45
- end
46
- end
47
- end
48
- end
49
- end
50
- end
51
- end
52
- end
@@ -1,48 +0,0 @@
1
- require_relative './infinitives_builder'
2
- require_relative './participles_builder'
3
-
4
- module Linguistics
5
- module Latin
6
- module Verb
7
- class LatinVerb
8
- module Mutators
9
- class Irregular
10
- class Revivifier
11
- def initialize(verb, structure)
12
- @verb = verb
13
- @structure = structure
14
- build_tense_blocks!
15
- build_infinitives!
16
- build_participles!
17
- end
18
-
19
- private
20
-
21
- def build_tense_blocks!
22
- @structure['tense_blocks'].each_pair do |tense_block_name, serialized_tense_block|
23
- @verb.singleton_class.class_eval do
24
- define_method tense_block_name.to_sym do
25
- TenseBlock.new serialized_tense_block["data"], { :meaning => MEANINGS[tense_block_name.to_sym] }
26
- end
27
- end
28
- end
29
- end
30
-
31
- def build_infinitives!
32
- irregular_infinitives = @structure['infinitives']['data']
33
- return if irregular_infinitives.nil?
34
- InfinitivesBuilder.new(@verb, irregular_infinitives)
35
- end
36
-
37
- def build_participles!
38
- irregular_participles = @structure['participles']['data']
39
- return if irregular_participles.nil?
40
- ParticiplesBuilder.new(@verb, irregular_participles)
41
- end
42
- end
43
- end
44
- end
45
- end
46
- end
47
- end
48
- end
@@ -1,35 +0,0 @@
1
- module Linguistics
2
- module Latin
3
- module Verb
4
- class LatinVerb
5
- module Mutators
6
- class Irregular
7
- class Revivifier
8
- class ParticiplesBuilder
9
- def initialize(verb, participles_structure)
10
- @verb = verb
11
- @participles_structure = participles_structure
12
- mutate!
13
- end
14
-
15
- def mutate!
16
- i = OpenStruct.new(@participles_structure)
17
-
18
- @verb.instance_exec do
19
- @__irregular_participles = i
20
- def present_active_participle; @__irregular_participles.present_active_participle; end
21
- def future_active_participle; @__irregular_participles.future_active_participle; end
22
- def perfect_passive_participle; @__irregular_participles.perfect_passive_participle; end
23
- def future_passive_participle; @__irregular_participles.future_passive_participle; end
24
- def gerundive; @__irregular_participles.gerundive; end
25
- def gerund; @__irregular_participles.d; end
26
- end
27
- end
28
- end
29
- end
30
- end
31
- end
32
- end
33
- end
34
- end
35
- end
@@ -1,37 +0,0 @@
1
- module Linguistics
2
- module Latin
3
- module Verb
4
- class LatinVerb
5
- module Mutators
6
- class Irregular
7
- class PresentOnlyIrregularMask
8
- def initialize(verb)
9
- @verb = verb
10
- end
11
-
12
- def apply!
13
- return unless irregular_and_present_only?
14
- @verb.instance_eval do
15
- def classification
16
- Classification::PresentOnly
17
- end
18
-
19
- def present_only?
20
- true
21
- end
22
- end
23
- end
24
-
25
- private
26
-
27
- # Very irregular irregulars, A&G206, e/f
28
- def irregular_and_present_only?
29
- @verb.original_string.match(%r'^(aiō|quaesō|ovāre)$')
30
- end
31
- end
32
- end
33
- end
34
- end
35
- end
36
- end
37
- end
@@ -1,25 +0,0 @@
1
- require_relative 'irregular/json_deserializer'
2
- require_relative 'irregular/json_revivifier'
3
- require_relative 'irregular/present_only_irregular_mask'
4
-
5
- module Linguistics
6
- module Latin
7
- module Verb
8
- class LatinVerb
9
- module Mutators
10
- class Irregular
11
- def initialize(verb)
12
- @verb = verb
13
- @deserializer = Deserializer.new(@verb)
14
- end
15
-
16
- def mutate!
17
- Revivifier.new(@verb, @deserializer.revivified_data_structure)
18
- PresentOnlyIrregularMask.new(@verb).apply!
19
- end
20
- end
21
- end
22
- end
23
- end
24
- end
25
- end
@@ -1,17 +0,0 @@
1
- module Linguistics
2
- module Latin
3
- module Verb
4
- class LatinVerb
5
- module Mutators
6
- class Regular
7
- def initialize(verb)
8
- end
9
-
10
- def mutate!
11
- end
12
- end
13
- end
14
- end
15
- end
16
- end
17
- end
@@ -1,88 +0,0 @@
1
- module Linguistics
2
- module Latin
3
- module Verb
4
- class LatinVerb
5
- module Mutators
6
- class Semideponent
7
- def initialize(verb)
8
- @verb = verb
9
- @proxyVerb = LatinVerb.new(DeponentStringDeriver.new(@verb.original_string).proxy_string)
10
-
11
- mutate!
12
- end
13
-
14
- def mutate!
15
- p = @proxyVerb
16
- @verb.instance_eval do
17
- @proxyVerb = p
18
- def active_voice_indicative_mood_present_tense
19
- return @proxyVerb.send :active_voice_indicative_mood_present_tense
20
- end
21
-
22
- def active_voice_indicative_mood_imperfect_tense
23
- return @proxyVerb.send :active_voice_indicative_mood_imperfect_tense
24
- end
25
-
26
- def active_voice_indicative_mood_future_tense
27
- return @proxyVerb.send :active_voice_indicative_mood_future_tense
28
- end
29
-
30
- # These methods handle the strangeness of semi-deponents, it masks
31
- # passive perfects to active perfects
32
-
33
- def active_voice_indicative_mood_perfect_tense
34
- return @proxyVerb.send :passive_voice_indicative_mood_perfect_tense
35
- end
36
-
37
- def active_voice_indicative_mood_pastperfect_tense
38
- return @proxyVerb.send :passive_voice_indicative_mood_pastperfect_tense
39
- end
40
-
41
- def active_voice_indicative_mood_futureperfect_tense
42
- return @proxyVerb.send :passive_voice_indicative_mood_futureperfect_tense
43
- end
44
-
45
- def passive_voice_indicative_mood_perfect_tense
46
- return NullTenseBlock.new
47
- end
48
-
49
- def passive_voice_indicative_mood_pastperfect_tense
50
- return NullTenseBlock.new
51
- end
52
-
53
- def passive_voice_indicative_mood_futureperfect_tense
54
- return NullTenseBlock.new
55
- end
56
-
57
- # Subjunctives: 2 active, 2 passive
58
- def active_voice_subjunctive_mood_present_tense
59
- return @proxyVerb.send :active_voice_subjunctive_mood_present_tense
60
- end
61
-
62
- def active_voice_subjunctive_mood_imperfect_tense
63
- return @proxyVerb.send :active_voice_subjunctive_mood_imperfect_tense
64
- end
65
-
66
- def active_voice_subjunctive_mood_perfect_tense
67
- return @proxyVerb.send :passive_voice_subjunctive_mood_perfect_tense
68
- end
69
-
70
- def active_voice_subjunctive_mood_pastperfect_tense
71
- return @proxyVerb.send :passive_voice_subjunctive_mood_pastperfect_tense
72
- end
73
-
74
- def passive_voice_subjunctive_mood_perfect_tense
75
- return NullTenseBlock.new
76
- end
77
-
78
- def passive_voice_subjunctive_mood_pastperfect_tense
79
- return NullTenseBlock.new
80
- end
81
- end
82
- end
83
- end
84
- end
85
- end
86
- end
87
- end
88
- end