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,19 +0,0 @@
1
- module Linguistics
2
- module Latin
3
- module Verb
4
- class LatinVerb
5
- class LatinVerbClassifier
6
- class RegularVerbClassificationStrategy < VerbClassificationStrategy
7
- def self.classification
8
- Classification::Regular
9
- end
10
-
11
- def applicable?
12
- true
13
- end
14
- end
15
- end
16
- end
17
- end
18
- end
19
- end
@@ -1,19 +0,0 @@
1
- module Linguistics
2
- module Latin
3
- module Verb
4
- class LatinVerb
5
- class LatinVerbClassifier
6
- class SemideponentVerbClassificationStrategy < VerbClassificationStrategy
7
- def self.classification
8
- Classification::Semideponent
9
- end
10
-
11
- def applicable?
12
- Linguistics::Latin::Verb::SEMI_DEPONENTS.keys.any?{ |k| first_pres=~/#{k}$/} && input !~ /PreventDeponentInfiniteRegress/
13
- end
14
- end
15
- end
16
- end
17
- end
18
- end
19
- end
@@ -1,31 +0,0 @@
1
- module Linguistics
2
- module Latin
3
- module Verb
4
- class LatinVerb
5
- class LatinVerbClassifier
6
- class VerbClassificationStrategy
7
- def initialize(classifier)
8
- @classifier = classifier
9
- end
10
-
11
- protected
12
-
13
- def first_pres
14
- return "" unless input
15
- input.split(/\s+/)[0]
16
- end
17
-
18
- def infinitive
19
- return "" unless input
20
- input.split(/\s+/)[1]
21
- end
22
-
23
- def input
24
- @classifier.input || ''
25
- end
26
- end
27
- end
28
- end
29
- end
30
- end
31
- end
@@ -1,20 +0,0 @@
1
- module Linguistics
2
- module Latin
3
- module Verb
4
- class LatinVerb
5
- class LatinVerbClassifier
6
- class VeryIrregularVerbClassificationStrategy < VerbClassificationStrategy
7
- # Very irregular irregulars, A&G206, e/f
8
- def self.classification
9
- Classification::Irregular
10
- end
11
-
12
- def applicable?
13
- input =~ %r'^(aiō|quaesō|ovāre)$'
14
- end
15
- end
16
- end
17
- end
18
- end
19
- end
20
- end
@@ -1,76 +0,0 @@
1
- require_relative 'classifier/strategies/verb_classification_strategy'
2
- require_relative 'classifier/strategies/defective_verb_classification_strategy'
3
- require_relative 'classifier/strategies/irregular_verb_classification_strategy'
4
- require_relative 'classifier/strategies/semideponent_verb_classification_strategy'
5
- require_relative 'classifier/strategies/impersonal_verb_classification_strategy'
6
- require_relative 'classifier/strategies/very_irregular_verb_classification_strategy'
7
- require_relative 'classifier/strategies/deponent_verb_classification_strategy'
8
- require_relative 'classifier/strategies/present_only_verb_classification_strategy'
9
- require_relative 'classifier/strategies/regular_verb_classification_strategy'
10
-
11
- module Linguistics
12
- module Latin
13
- module Verb
14
- class LatinVerb
15
- class LatinVerbClassifier
16
- attr_reader :classification, :input
17
-
18
- def initialize(input, opts={})
19
- @input = input
20
- @strategies = opts[:strategies] || default_strategies
21
- end
22
-
23
- def classification
24
- applicable_strategy = @strategies.detect do |strategy|
25
- strategy.new(self).applicable?
26
- end
27
- applicable_strategy.classification
28
- end
29
-
30
- def present_only?
31
- classification == Linguistics::Latin::Verb::Classification::PresentOnly
32
- end
33
-
34
- def deponent?
35
- classification == Linguistics::Latin::Verb::Classification::Deponent
36
- end
37
-
38
- def semideponent?
39
- classification == Linguistics::Latin::Verb::Classification::Semideponent
40
- end
41
-
42
- def impersonal?
43
- classification == Linguistics::Latin::Verb::Classification::Impersonal
44
- end
45
-
46
- def irregular?
47
- classification == Linguistics::Latin::Verb::Classification::Irregular
48
- end
49
-
50
- def regular?
51
- classification == Linguistics::Latin::Verb::Classification::Regular
52
- end
53
-
54
- def short_class
55
- classification.to_s.gsub(/.*::(\w+)$/,"\\1")
56
- end
57
-
58
- private
59
-
60
- def default_strategies
61
- [
62
- DefectiveVerbClassificationStrategy,
63
- IrregularVerbClassificationStrategy,
64
- SemideponentVerbClassificationStrategy,
65
- ImpersonalVerbClassificationStrategy,
66
- VeryIrregularVerbClassificationStrategy,
67
- PresentonlyVerbClassificationStrategy,
68
- DeponentVerbClassificationStrategy,
69
- RegularVerbClassificationStrategy
70
- ]
71
- end
72
- end
73
- end
74
- end
75
- end
76
- end
@@ -1,40 +0,0 @@
1
- module Linguistics
2
- module Latin
3
- module Verb
4
- class LatinVerb
5
- class ImperativesHandler
6
- extend Forwardable
7
-
8
- def_delegators :@verb, :stem, :present_active_infinitive
9
-
10
- IMPERATIVE_EXCEPTIONS = {
11
- "ducere" => %w(duc ducite),
12
- "dicere" => %w(dic dicite),
13
- "facere" => %w(fac facite),
14
- "ferre" => %w(fer ferte),
15
- "nolere" => %w(nolo nolite)
16
- }
17
-
18
- def initialize(verb)
19
- @verb = verb
20
- end
21
-
22
- def imperatives
23
- args = exceptional_imperative? ? calculate_exceptional_imperatives : [stem, present_active_infinitive]
24
- Linguistics::Latin::Verb::ImperativeBlock.new(*args, @verb)
25
- end
26
-
27
- private
28
-
29
- def exceptional_imperative?
30
- IMPERATIVE_EXCEPTIONS.has_key?(present_active_infinitive)
31
- end
32
-
33
- def calculate_exceptional_imperatives
34
- IMPERATIVE_EXCEPTIONS[present_active_infinitive]
35
- end
36
- end
37
- end
38
- end
39
- end
40
- end
@@ -1,50 +0,0 @@
1
- require_relative './passive_infinitive_factory'
2
-
3
- module Linguistics
4
- module Latin
5
- module Verb
6
- class LatinVerb
7
- class Infinitivizer
8
- extend Forwardable
9
-
10
- def_delegators :@verb, :first_person_perfect, :future_active_participle, :verb_type, :present_active_infinitive, :perfect_passive_participle, :supine
11
-
12
- def initialize(verb)
13
- @verb = verb
14
- end
15
-
16
- def infinitives
17
- {
18
- :present_active_infinitive => present_active_infinitive,
19
- :perfect_active_infinitive => perfect_active_infinitive,
20
- :future_active_infinitive => future_active_infinitive,
21
- :present_passive_infinitive => present_passive_infinitive,
22
- :perfect_passive_infinitive => perfect_passive_infinitive,
23
- :future_passive_infinitive => future_passive_infinitive
24
- }
25
- end
26
-
27
- def perfect_active_infinitive
28
- first_person_perfect + "sse"
29
- end
30
-
31
- def future_active_infinitive
32
- future_active_participle.sub(/,.*/,'') + " esse"
33
- end
34
-
35
- def present_passive_infinitive
36
- PassiveInfinitiveVactory.new(@verb).passive_infinitive
37
- end
38
-
39
- def perfect_passive_infinitive
40
- perfect_passive_participle + " esse"
41
- end
42
-
43
- def future_passive_infinitive
44
- supine[:accusative] + " īrī"
45
- end
46
- end
47
- end
48
- end
49
- end
50
- end
@@ -1,58 +0,0 @@
1
- module Linguistics
2
- module Latin
3
- module Verb
4
- class LatinVerb
5
- class Participler
6
- include Linguistics::Latin::Phonographia
7
- extend Forwardable
8
-
9
- def_delegators :@verb, :passive_perfect_participle, :participial_stem
10
-
11
- def initialize(verb)
12
- @verb = verb
13
- end
14
-
15
- def present_active_participle
16
- raise "Participial stem was nil" if participial_stem.nil?
17
- endings = %w(ns ntis)
18
- endings.collect{ |x| fix_macrons(participial_stem + x.chomp) }.join(', ')
19
- end
20
-
21
- def future_active_participle
22
- mybase = passive_perfect_participle.gsub(/u[sm]$/, "ūr")
23
- singular_endings = %w(us a um)
24
- singular_endings.collect{ |x| mybase + "#{x}".chomp }.join(', ')
25
- end
26
-
27
- def perfect_passive_participle
28
- mybase = passive_perfect_participle.sub(/u[sm]$/,'')
29
- singular_endings=%w(us a um)
30
- singular_endings.collect{ |x| mybase + "#{x}".chomp }.join(', ')
31
- end
32
-
33
- def future_passive_participle
34
- mybase = participial_stem + "nd"
35
- singular_endings = %w(us a um)
36
- singular_endings.collect{ |x| fix_macrons(mybase + "#{x}".chomp) }.join(', ')
37
- end
38
-
39
- def gerundive
40
- @verb.future_passive_participle
41
- end
42
-
43
- def gerund
44
- b = gerundive.sub( /.*\s+(.*)um.*$/, "\\1" )
45
- b += "ī, ō, etc."
46
- end
47
-
48
- def supine
49
- acc = passive_perfect_participle
50
- abl = acc.sub( /^(.*)um$/, "\\1" )
51
- abl += "ū"
52
- {:ablative => abl, :accusative => acc}
53
- end
54
- end
55
- end
56
- end
57
- end
58
- end
@@ -1,42 +0,0 @@
1
- module Linguistics
2
- module Latin
3
- module Verb
4
- class LatinVerb
5
- class Infinitivizer
6
- class PassiveInfinitiveVactory
7
- extend Forwardable
8
- def_delegators :@verb, :present_active_infinitive, :verb_type
9
-
10
- MAPPING = {
11
- First: [/(.*)e$/,"\\1ī"],
12
- Second: [/(.*)e$/,"\\1ī"],
13
- ThirdIO: [/(.*)ere$/,"\\1ī"],
14
- Third: [/(.*)ere$/,"\\1ī"],
15
- Fourth: [/(.*)e$/,"\\1ī"],
16
- Irregular: [/(.*)/,"\\1"]
17
- }
18
-
19
-
20
- def initialize(verb)
21
- @verb = verb
22
- end
23
-
24
- def passive_infinitive
25
- present_active_infinitive.gsub(*mutation_for_type)
26
- end
27
-
28
- private
29
-
30
- def mutation_for_type
31
- MAPPING[type_key]
32
- end
33
-
34
- def type_key
35
- verb_type.ordinal_name_key
36
- end
37
- end
38
- end
39
- end
40
- end
41
- end
42
- end
@@ -1,32 +0,0 @@
1
- module Linguistics
2
- module Latin
3
- module Verb
4
- class LatinVerb
5
- class PresentOnlyChecker
6
- def initialize(original_string)
7
- @original_string = original_string
8
- end
9
-
10
- def present_only?
11
- listed_as_present_only?
12
- end
13
-
14
- private
15
-
16
- def listed_as_present_only?
17
- Linguistics::Latin::Verb::PRESENT_ONLY.member?( first_person_present_tense ) ||
18
- Linguistics::Latin::Verb::PRESENT_ONLY.member?( present_active_infinitive )
19
- end
20
-
21
- def first_person_present_tense
22
- @original_string.split(/\s+/)[0]
23
- end
24
-
25
- def present_active_infinitive
26
- @original_string.split(/\s+/)[1]
27
- end
28
- end
29
- end
30
- end
31
- end
32
- end
@@ -1,35 +0,0 @@
1
- module Linguistics
2
- module Latin
3
- module Verb
4
- class LatinVerb
5
- class LatinVerbPrincipalPartsExtractor
6
- def initialize(input_string, classification)
7
- @data_string = input_string
8
- @classification = classification
9
- end
10
-
11
- def principal_parts
12
- @data_string.split(/\s+/)
13
- end
14
-
15
- def first_person_singular
16
- principal_parts[0]
17
- end
18
-
19
- def present_active_infinitive
20
- principal_parts[1]
21
- end
22
-
23
- def first_person_perfect
24
- principal_parts[2]
25
- end
26
-
27
- def passive_perfect_participle
28
- principal_parts[3]
29
- end
30
-
31
- end
32
- end
33
- end
34
- end
35
- end
@@ -1,81 +0,0 @@
1
- module Linguistics
2
- module Latin
3
- module Verb
4
- class LatinVerb
5
- class LatinverbStemDeriver
6
- def initialize(verb)
7
- @verb = verb
8
- end
9
-
10
- def stem
11
- verb_is_regular? ? calculate_stem : calculate_deponent_proxy_stem
12
- end
13
-
14
- def participial_stem
15
- if present_active_infinitive.to_s =~ /(.*ā)re$/
16
- return $1
17
- end
18
-
19
- if present_active_infinitive.to_s =~ /(.*ē)re$/
20
- return $1
21
- end
22
-
23
- if present_active_infinitive.to_s =~ /(.*)ere$/
24
- match=$1
25
- if first_person_singular =~ /iō/
26
- return match + "iē"
27
- else
28
- return match + "e"
29
- end
30
- end
31
-
32
- if present_active_infinitive.to_s =~ /(.*)īre$/
33
- return $1 + "iē"
34
- end
35
- end
36
-
37
- private
38
-
39
- def calculate_deponent_proxy_stem
40
- DeponentStringDeriver.new(@verb.original_string).proxy_string.split(/\s+/)[1]
41
- end
42
-
43
- def verb_is_regular?
44
- @verb.classifier.regular?
45
- end
46
-
47
- def present_active_infinitive
48
- @verb.present_active_infinitive
49
- end
50
-
51
- def first_person_singular
52
- @verb.first_person_singular
53
- end
54
-
55
- def deponent_or_impersonal?
56
- @verb.classifier.deponent? or @verb.classifier.semideponent? or @verb.classifier.impersonal?
57
- end
58
-
59
- def calculate_stem
60
- if present_active_infinitive =~ /āre$/
61
- return present_active_infinitive.gsub(/(.*)āre$/,'\\1ā')
62
- end
63
- if present_active_infinitive =~ /ēre$/
64
- return present_active_infinitive.gsub(/(.*)ēre$/,'\\1ē')
65
- end
66
- if present_active_infinitive =~ /ere$/
67
- if first_person_singular =~ /iō$/
68
- return present_active_infinitive.gsub(/(.*)ere$/,'\\1')
69
- else
70
- return present_active_infinitive.gsub(/(.*)ere$/,'\\1')
71
- end
72
- end
73
- if present_active_infinitive =~ /īre$/
74
- return present_active_infinitive.gsub(/(.*)īre$/,'\\1')
75
- end
76
- end
77
- end
78
- end
79
- end
80
- end
81
- end
@@ -1,35 +0,0 @@
1
- module Linguistics
2
- module Latin
3
- module Verb
4
- class LatinVerb
5
- class LatinVerbTypeEvaluator
6
- extend Forwardable
7
- # "Type" is key stem associated with the verb versus the
8
- # classification. i.e. a verb might be "classified" as "Deponent"
9
- # but has a "type" of first conjugation e.g. miror / mirari
10
- def_delegators :@verb, :first_person_singular, :present_active_infinitive
11
-
12
- def initialize(verb)
13
- @verb = verb
14
- end
15
-
16
- def type
17
- if present_active_infinitive =~ /āre$/
18
- Linguistics::Latin::Verb::VerbTypes::First
19
- elsif present_active_infinitive =~ /ēre$/
20
- Linguistics::Latin::Verb::VerbTypes::Second
21
- elsif present_active_infinitive =~ /ere$/
22
- first_person_singular =~ /i.$/ ? Linguistics::Latin::Verb::VerbTypes::ThirdIO : Linguistics::Latin::Verb::VerbTypes::Third
23
- elsif present_active_infinitive =~ /.+īre$/
24
- Linguistics::Latin::Verb::VerbTypes::Fourth
25
- elsif (present_active_infinitive =~ /ī$/ and first_person_singular =~ /r$/)
26
- LatinVerb.new(DeponentStringDeriver.new(@verb.original_string).proxy_string).verb_type
27
- else
28
- Linguistics::Latin::Verb::VerbTypes::Irregular
29
- end
30
- end
31
- end
32
- end
33
- end
34
- end
35
- end
@@ -1,9 +0,0 @@
1
- require_relative './components/chart_presenter'
2
- require_relative './components/infinitivizer'
3
- require_relative './components/classifier'
4
- require_relative './components/principal_parts_extractor'
5
- require_relative './components/type_evaluator'
6
- require_relative './components/participler'
7
- require_relative './components/validator'
8
- require_relative './components/imperatives_handler'
9
- require_relative './components/stem_deriver'
@@ -1,41 +0,0 @@
1
- module Linguistics
2
- module Latin
3
- module Verb
4
- class LatinVerb
5
- class DynamicMethodResolver
6
- def initialize(verb, method_name)
7
- @verb = verb
8
- @method_name = method_name.to_s
9
- end
10
-
11
- def components
12
- @method_name.split('_')
13
- end
14
-
15
- def tense_method
16
- Array(components[0..5]).join('_')
17
- end
18
-
19
- def vector_specifier
20
- Array(components[6..-1]).join('_')
21
- end
22
-
23
- def supported_method?
24
- !(tense_method.nil? || vector_specifier.nil?) && @method_name.match(/_/)
25
- end
26
-
27
- def apply!
28
- if @verb.respond_to?(tense_method.to_sym)
29
- tense_block = @verb.send(tense_method.to_sym)
30
- return false if tense_block.nil?
31
- tense_block.send(vector_specifier.to_sym)
32
- else
33
- false
34
- end
35
- end
36
-
37
- end
38
- end
39
- end
40
- end
41
- end
@@ -1,10 +0,0 @@
1
- module Linguistics
2
- module Latin
3
- module Verb
4
- class LatinVerb
5
- class LatinVerbInitializationError
6
- end
7
- end
8
- end
9
- end
10
- end
@@ -1,17 +0,0 @@
1
- module Linguistics
2
- module Latin
3
- module Verb
4
- class LatinVerb
5
- def to_hash
6
- methods.grep(/tense\z/).inject({'original_string' => @original_string}) do |memo, tense_block_identifier|
7
- ts = tense_block_identifier.to_sym
8
- memo[ts] = self.send(ts)
9
- memo
10
- end
11
- end
12
-
13
- alias_method :to_h, :to_hash
14
- end
15
- end
16
- end
17
- end
@@ -1,41 +0,0 @@
1
- require 'json'
2
-
3
- module Linguistics
4
- module Latin
5
- module Verb
6
- class LatinVerb
7
- def self.json_create(o)
8
- new(o)
9
- end
10
-
11
- def to_json(*a)
12
- json_hash = {'json_class' => self.class.name}
13
-
14
- # In the case that we're working with a regular verb, the only thing
15
- # we need to save is the original string, since everything can be
16
- # re-derived from it easily.
17
- unless self.irregular?
18
- # While this single string is sufficient to freeze and revivifty
19
- # the verb, it means that the JSON structure is rather vacuous.
20
- # Given this, the hash is enriched so that the JSON data is
21
- # useful. Nevertheless, in the revivification process, only
22
- # 'orig_string' is used.
23
- %w{original_string classification stem}.each do |k|
24
- json_hash[k] = self.send k.to_sym
25
- end
26
- json_hash['tense_list' ] = {}
27
- methods.grep(/tense\z/).each do |t|
28
- json_hash['tense_list'][t.to_s] = self.send t.to_sym
29
- end
30
- json_hash['irregular'] = irregular?
31
- return json_hash.to_json(*a)
32
- end
33
- end
34
-
35
- def pretty_generate
36
- JSON.pretty_generate(self.to_h)
37
- end
38
- end
39
- end
40
- end
41
- end
@@ -1,15 +0,0 @@
1
- require 'yaml'
2
-
3
- module Linguistics
4
- module Latin
5
- module Verb
6
- class LatinVerb
7
- def to_yaml
8
- to_hash.to_yaml
9
- end
10
-
11
- alias_method :to_y, :to_yaml
12
- end
13
- end
14
- end
15
- end