latinverb 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +1 -0
- data/Gemfile.lock +28 -6
- data/README.markdown +1 -1
- data/Rakefile +1 -0
- data/latinverb.gemspec +5 -3
- data/lib/latinverb/components/chart_presenter.rb +81 -0
- data/lib/latinverb/components/classifier/strategies/defective_verb_classification_strategy.rb +19 -0
- data/lib/latinverb/components/classifier/strategies/deponent_verb_classification_strategy.rb +19 -0
- data/lib/latinverb/components/classifier/strategies/impersonal_verb_classification_strategy.rb +19 -0
- data/lib/latinverb/components/classifier/strategies/irregular_verb_classification_strategy.rb +19 -0
- data/lib/latinverb/components/classifier/strategies/present_only_verb_classification_strategy.rb +21 -0
- data/lib/latinverb/components/classifier/strategies/regular_verb_classification_strategy.rb +19 -0
- data/lib/latinverb/components/classifier/strategies/semideponent_verb_classification_strategy.rb +19 -0
- data/lib/latinverb/components/classifier/strategies/verb_classification_strategy.rb +31 -0
- data/lib/latinverb/components/classifier/strategies/very_irregular_verb_classification_strategy.rb +20 -0
- data/lib/latinverb/components/classifier.rb +76 -0
- data/lib/latinverb/components/imperatives_handler.rb +40 -0
- data/lib/latinverb/components/infinitivizer.rb +50 -0
- data/lib/latinverb/components/participler.rb +58 -0
- data/lib/latinverb/components/passive_infinitive_factory.rb +42 -0
- data/lib/latinverb/components/present_only_checker.rb +32 -0
- data/lib/latinverb/components/principal_parts_extractor.rb +35 -0
- data/lib/latinverb/components/stem_deriver.rb +81 -0
- data/lib/latinverb/components/type_evaluator.rb +35 -0
- data/lib/latinverb/components/validator.rb +33 -0
- data/lib/latinverb/components.rb +9 -0
- data/lib/latinverb/dynamic_method_resolver.rb +41 -0
- data/lib/latinverb/errors.rb +10 -0
- data/lib/latinverb/imperative_block/imperative_rule_factory.rb +35 -0
- data/lib/latinverb/imperative_block.rb +71 -0
- data/lib/latinverb/paradigmatic_verbs.rb +21 -0
- data/lib/latinverb/serialization/hash.rb +17 -0
- data/lib/latinverb/serialization/json.rb +41 -0
- data/lib/latinverb/serialization/yaml.rb +15 -0
- data/lib/latinverb/serialization.rb +3 -0
- data/lib/latinverb/tense_block/null_tense_block.rb +12 -0
- data/lib/latinverb/tense_block/vector_resolution_delegate.rb +89 -0
- data/lib/latinverb/tense_block.rb +52 -0
- data/lib/latinverb/tense_method_applicator/defective_checker.rb +21 -0
- data/lib/{linguistics/latin/verb/latinverb/classmethods.rb → latinverb/tense_method_applicator/deponent_string_deriver.rb} +15 -69
- data/lib/latinverb/tense_method_applicator/first_builder.rb +98 -0
- data/lib/latinverb/tense_method_applicator/fourth.rb +100 -0
- data/lib/latinverb/tense_method_applicator/fourth_builder.rb +100 -0
- data/lib/latinverb/tense_method_applicator/irregular_builder.rb +117 -0
- data/lib/latinverb/tense_method_applicator/mutator_for_classification_factory.rb +38 -0
- data/lib/latinverb/tense_method_applicator/mutator_for_verb_type.rb +38 -0
- data/lib/latinverb/tense_method_applicator/mutators/deponent/imperative_mutator.rb +49 -0
- data/lib/latinverb/tense_method_applicator/mutators/deponent/infinitive_mutator.rb +42 -0
- data/lib/latinverb/tense_method_applicator/mutators/deponent/participle_mutator.rb +47 -0
- data/lib/latinverb/tense_method_applicator/mutators/deponent/tense_block_mutator.rb +55 -0
- data/lib/latinverb/tense_method_applicator/mutators/deponent.rb +41 -0
- data/lib/latinverb/tense_method_applicator/mutators/impersonal.rb +27 -0
- data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_imperative_mood_future_tense_strategy.rb +29 -0
- data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_imperative_mood_present_tense_strategy.rb +29 -0
- data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_indicative_mood_future_tense_strategy.rb +35 -0
- data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_indicative_mood_futureperfect_tense_strategy.rb +28 -0
- data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_indicative_mood_imperfect_tense_strategy.rb +24 -0
- data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_indicative_mood_pastperfect_tense_strategy.rb +28 -0
- data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_indicative_mood_perfect_tense_strategy.rb +29 -0
- data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_indicative_mood_present_tense_strategy.rb +24 -0
- data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_subjunctive_mood_imperfect_tense_strategy.rb +29 -0
- data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_subjunctive_mood_pastperfect_tense_strategy.rb +30 -0
- data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_subjunctive_mood_perfect_tense_strategy.rb +30 -0
- data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_subjunctive_mood_present_tense_strategy.rb +24 -0
- data/lib/latinverb/tense_method_applicator/mutators/invariant/imperatives.rb +53 -0
- data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_indicative_mood_future_tense_strategy.rb +24 -0
- data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_indicative_mood_futureperfect_tense_strategy.rb +27 -0
- data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_indicative_mood_imperfect_tense_strategy.rb +24 -0
- data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_indicative_mood_pastperfect_tense_strategy.rb +27 -0
- data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_indicative_mood_perfect_tense_strategy.rb +27 -0
- data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_indicative_mood_present_tense_strategy.rb +24 -0
- data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_subjunctive_mood_imperfect_tense_strategy.rb +30 -0
- data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_subjunctive_mood_pastperfect_tense_strategy.rb +33 -0
- data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_subjunctive_mood_perfect_tense_strategy.rb +33 -0
- data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_subjunctive_mood_present_tense_strategy.rb +24 -0
- data/lib/latinverb/tense_method_applicator/mutators/invariant/triplicate_and_pluralize_formatters.rb +26 -0
- data/lib/latinverb/tense_method_applicator/mutators/invariant.rb +65 -0
- data/lib/latinverb/tense_method_applicator/mutators/irregular/infinitives_builder.rb +35 -0
- data/lib/latinverb/tense_method_applicator/mutators/irregular/json_deserializer.rb +52 -0
- data/lib/latinverb/tense_method_applicator/mutators/irregular/json_revivifier.rb +48 -0
- data/lib/latinverb/tense_method_applicator/mutators/irregular/participles_builder.rb +35 -0
- data/lib/latinverb/tense_method_applicator/mutators/irregular/present_only_irregular_mask.rb +37 -0
- data/lib/latinverb/tense_method_applicator/mutators/irregular.rb +25 -0
- data/lib/latinverb/tense_method_applicator/mutators/present_only.rb +18 -0
- data/lib/latinverb/tense_method_applicator/mutators/regular.rb +17 -0
- data/lib/latinverb/tense_method_applicator/mutators/semideponent.rb +88 -0
- data/lib/latinverb/tense_method_applicator/perfect_tense_remover.rb +26 -0
- data/lib/latinverb/tense_method_applicator/second_builder.rb +105 -0
- data/lib/latinverb/tense_method_applicator/tense_methods_vectorizer.rb +73 -0
- data/lib/latinverb/tense_method_applicator/third_builder.rb +93 -0
- data/lib/latinverb/tense_method_applicator/thirdio_builder.rb +100 -0
- data/lib/latinverb/tense_method_applicator.rb +55 -0
- data/lib/latinverb/version.rb +2 -3
- data/lib/latinverb.rb +63 -419
- data/test/{testDeponentFirstConjugation.rb → integration/deponent_first_conjugation_test.rb} +1 -1
- data/test/{testDeponentFourthConjugation.rb → integration/deponent_fourth_conjugation_test.rb} +1 -1
- data/test/{testDeponentSecondConjugation.rb → integration/deponent_second_conjugation_test.rb} +1 -1
- data/test/{testDeponentThirdConjugation.rb → integration/deponent_third_conjugation_test.rb} +2 -2
- data/test/{testDeponentThirdIOConjugation.rb → integration/deponent_third_io_conjugation_test.rb} +1 -1
- data/test/{testFirstConjugation.rb → integration/first_conjugation_test.rb} +3 -7
- data/test/{testFreakishVerbs.rb → integration/freakish_vs.rb_test.rb} +4 -4
- data/test/{testIrregularSum.rb → integration/irregular_sum_test.rb} +1 -1
- data/test/{testIrregulars.rb → integration/irregulars_test.rb} +1 -1
- data/test/{testLatinVerb.rb → integration/latin_verb_test.rb} +5 -25
- data/test/{testThirdConjugation.rb → integration/third_conjugation_test.rb} +19 -21
- data/test/unit/latinverb_accessible_reader_test.rb +18 -0
- data/test/unit/principal_parts_extractor_test.rb +33 -0
- metadata +151 -79
- data/lib/latinverb/chart.rb +0 -94
- data/lib/linguistics/latin/verb/classification_types.rb +0 -61
- data/lib/linguistics/latin/verb/constants.rb +0 -201
- data/lib/linguistics/latin/verb/deponent_tense_methods.rb +0 -85
- data/lib/linguistics/latin/verb/imperative_block.rb +0 -118
- data/lib/linguistics/latin/verb/infinitive_block.rb +0 -39
- data/lib/linguistics/latin/verb/infinitives.rb +0 -212
- data/lib/linguistics/latin/verb/irregulars.rb +0 -4393
- data/lib/linguistics/latin/verb/latinverb/data.rb +0 -87
- data/lib/linguistics/latin/verb/latinverb/defective_checker.rb +0 -17
- data/lib/linguistics/latin/verb/latinverb/deponent.rb +0 -159
- data/lib/linguistics/latin/verb/latinverb/display.rb +0 -22
- data/lib/linguistics/latin/verb/latinverb/impersonal.rb +0 -34
- data/lib/linguistics/latin/verb/latinverb/irregular.rb +0 -83
- data/lib/linguistics/latin/verb/latinverb/latin_verb_type_evaluator.rb +0 -32
- data/lib/linguistics/latin/verb/latinverb/latinverb_classifier.rb +0 -100
- data/lib/linguistics/latin/verb/latinverb/latinverb_input_sanitizer.rb +0 -32
- data/lib/linguistics/latin/verb/latinverb/latinverb_pp_extractor.rb +0 -106
- data/lib/linguistics/latin/verb/latinverb/metaprogramming.rb +0 -80
- data/lib/linguistics/latin/verb/latinverb/semideponent.rb +0 -28
- data/lib/linguistics/latin/verb/latinverb/validation.rb +0 -42
- data/lib/linguistics/latin/verb/latinverb/verbvector_description.rb +0 -50
- data/lib/linguistics/latin/verb/participle_block.rb +0 -36
- data/lib/linguistics/latin/verb/participles.rb +0 -202
- data/lib/linguistics/latin/verb/phonographia.rb +0 -109
- data/lib/linguistics/latin/verb/supine.rb +0 -42
- data/lib/linguistics/latin/verb/tense_block.rb +0 -227
- data/lib/linguistics/latin/verb/tense_definitions/first.rb +0 -92
- data/lib/linguistics/latin/verb/tense_definitions/fourth.rb +0 -92
- data/lib/linguistics/latin/verb/tense_definitions/impersonal.rb +0 -25
- data/lib/linguistics/latin/verb/tense_definitions/invariant.rb +0 -613
- data/lib/linguistics/latin/verb/tense_definitions/irregular.rb +0 -82
- data/lib/linguistics/latin/verb/tense_definitions/second.rb +0 -97
- data/lib/linguistics/latin/verb/tense_definitions/third.rb +0 -86
- data/lib/linguistics/latin/verb/tense_definitions/third_io.rb +0 -91
- data/test/testDeserializeInfinitives.rb +0 -36
- /data/test/{testAmbiguousLookups.rb → integration/ambiguous_lookups_test.rb} +0 -0
- /data/test/{testClusterResolution.rb → integration/cluster_resolution_test.rb} +0 -0
- /data/test/{testDataStructures.rb → integration/data_structures_test.rb} +0 -0
- /data/test/{testDefectSemiImp.rb → integration/defect_semi_imp_test.rb} +0 -0
- /data/test/{testFourthConjugation.rb → integration/fourth_conjugation_test.rb} +0 -0
- /data/test/{testImperativeBlock.rb → integration/imperative_block_test.rb} +0 -0
- /data/test/{testMacronRules.rb → integration/macron_rules_test.rb} +0 -0
- /data/test/{testSecondConjugation.rb → integration/second_conjugation_test.rb} +0 -0
- /data/test/{testThirdIOConjugation.rb → integration/third_io_conjugation_test.rb} +0 -0
@@ -0,0 +1,24 @@
|
|
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
|
@@ -0,0 +1,27 @@
|
|
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
|
@@ -0,0 +1,27 @@
|
|
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
|
@@ -0,0 +1,24 @@
|
|
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
|
@@ -0,0 +1,30 @@
|
|
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
|
@@ -0,0 +1,33 @@
|
|
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
|
@@ -0,0 +1,33 @@
|
|
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
|
@@ -0,0 +1,24 @@
|
|
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
|
data/lib/latinverb/tense_method_applicator/mutators/invariant/triplicate_and_pluralize_formatters.rb
ADDED
@@ -0,0 +1,26 @@
|
|
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
|
@@ -0,0 +1,65 @@
|
|
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
|
@@ -0,0 +1,35 @@
|
|
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
|
@@ -0,0 +1,52 @@
|
|
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
|
@@ -0,0 +1,48 @@
|
|
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
|
@@ -0,0 +1,35 @@
|
|
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
|
@@ -0,0 +1,37 @@
|
|
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
|
@@ -0,0 +1,25 @@
|
|
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
|