latinverb 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (154) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +1 -0
  3. data/Gemfile.lock +28 -6
  4. data/README.markdown +1 -1
  5. data/Rakefile +1 -0
  6. data/latinverb.gemspec +5 -3
  7. data/lib/latinverb/components/chart_presenter.rb +81 -0
  8. data/lib/latinverb/components/classifier/strategies/defective_verb_classification_strategy.rb +19 -0
  9. data/lib/latinverb/components/classifier/strategies/deponent_verb_classification_strategy.rb +19 -0
  10. data/lib/latinverb/components/classifier/strategies/impersonal_verb_classification_strategy.rb +19 -0
  11. data/lib/latinverb/components/classifier/strategies/irregular_verb_classification_strategy.rb +19 -0
  12. data/lib/latinverb/components/classifier/strategies/present_only_verb_classification_strategy.rb +21 -0
  13. data/lib/latinverb/components/classifier/strategies/regular_verb_classification_strategy.rb +19 -0
  14. data/lib/latinverb/components/classifier/strategies/semideponent_verb_classification_strategy.rb +19 -0
  15. data/lib/latinverb/components/classifier/strategies/verb_classification_strategy.rb +31 -0
  16. data/lib/latinverb/components/classifier/strategies/very_irregular_verb_classification_strategy.rb +20 -0
  17. data/lib/latinverb/components/classifier.rb +76 -0
  18. data/lib/latinverb/components/imperatives_handler.rb +40 -0
  19. data/lib/latinverb/components/infinitivizer.rb +50 -0
  20. data/lib/latinverb/components/participler.rb +58 -0
  21. data/lib/latinverb/components/passive_infinitive_factory.rb +42 -0
  22. data/lib/latinverb/components/present_only_checker.rb +32 -0
  23. data/lib/latinverb/components/principal_parts_extractor.rb +35 -0
  24. data/lib/latinverb/components/stem_deriver.rb +81 -0
  25. data/lib/latinverb/components/type_evaluator.rb +35 -0
  26. data/lib/latinverb/components/validator.rb +33 -0
  27. data/lib/latinverb/components.rb +9 -0
  28. data/lib/latinverb/dynamic_method_resolver.rb +41 -0
  29. data/lib/latinverb/errors.rb +10 -0
  30. data/lib/latinverb/imperative_block/imperative_rule_factory.rb +35 -0
  31. data/lib/latinverb/imperative_block.rb +71 -0
  32. data/lib/latinverb/paradigmatic_verbs.rb +21 -0
  33. data/lib/latinverb/serialization/hash.rb +17 -0
  34. data/lib/latinverb/serialization/json.rb +41 -0
  35. data/lib/latinverb/serialization/yaml.rb +15 -0
  36. data/lib/latinverb/serialization.rb +3 -0
  37. data/lib/latinverb/tense_block/null_tense_block.rb +12 -0
  38. data/lib/latinverb/tense_block/vector_resolution_delegate.rb +89 -0
  39. data/lib/latinverb/tense_block.rb +52 -0
  40. data/lib/latinverb/tense_method_applicator/defective_checker.rb +21 -0
  41. data/lib/{linguistics/latin/verb/latinverb/classmethods.rb → latinverb/tense_method_applicator/deponent_string_deriver.rb} +15 -69
  42. data/lib/latinverb/tense_method_applicator/first_builder.rb +98 -0
  43. data/lib/latinverb/tense_method_applicator/fourth.rb +100 -0
  44. data/lib/latinverb/tense_method_applicator/fourth_builder.rb +100 -0
  45. data/lib/latinverb/tense_method_applicator/irregular_builder.rb +117 -0
  46. data/lib/latinverb/tense_method_applicator/mutator_for_classification_factory.rb +38 -0
  47. data/lib/latinverb/tense_method_applicator/mutator_for_verb_type.rb +38 -0
  48. data/lib/latinverb/tense_method_applicator/mutators/deponent/imperative_mutator.rb +49 -0
  49. data/lib/latinverb/tense_method_applicator/mutators/deponent/infinitive_mutator.rb +42 -0
  50. data/lib/latinverb/tense_method_applicator/mutators/deponent/participle_mutator.rb +47 -0
  51. data/lib/latinverb/tense_method_applicator/mutators/deponent/tense_block_mutator.rb +55 -0
  52. data/lib/latinverb/tense_method_applicator/mutators/deponent.rb +41 -0
  53. data/lib/latinverb/tense_method_applicator/mutators/impersonal.rb +27 -0
  54. data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_imperative_mood_future_tense_strategy.rb +29 -0
  55. data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_imperative_mood_present_tense_strategy.rb +29 -0
  56. data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_indicative_mood_future_tense_strategy.rb +35 -0
  57. data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_indicative_mood_futureperfect_tense_strategy.rb +28 -0
  58. data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_indicative_mood_imperfect_tense_strategy.rb +24 -0
  59. data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_indicative_mood_pastperfect_tense_strategy.rb +28 -0
  60. data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_indicative_mood_perfect_tense_strategy.rb +29 -0
  61. data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_indicative_mood_present_tense_strategy.rb +24 -0
  62. data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_subjunctive_mood_imperfect_tense_strategy.rb +29 -0
  63. data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_subjunctive_mood_pastperfect_tense_strategy.rb +30 -0
  64. data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_subjunctive_mood_perfect_tense_strategy.rb +30 -0
  65. data/lib/latinverb/tense_method_applicator/mutators/invariant/active_voice_subjunctive_mood_present_tense_strategy.rb +24 -0
  66. data/lib/latinverb/tense_method_applicator/mutators/invariant/imperatives.rb +53 -0
  67. data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_indicative_mood_future_tense_strategy.rb +24 -0
  68. data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_indicative_mood_futureperfect_tense_strategy.rb +27 -0
  69. data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_indicative_mood_imperfect_tense_strategy.rb +24 -0
  70. data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_indicative_mood_pastperfect_tense_strategy.rb +27 -0
  71. data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_indicative_mood_perfect_tense_strategy.rb +27 -0
  72. data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_indicative_mood_present_tense_strategy.rb +24 -0
  73. data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_subjunctive_mood_imperfect_tense_strategy.rb +30 -0
  74. data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_subjunctive_mood_pastperfect_tense_strategy.rb +33 -0
  75. data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_subjunctive_mood_perfect_tense_strategy.rb +33 -0
  76. data/lib/latinverb/tense_method_applicator/mutators/invariant/passive_voice_subjunctive_mood_present_tense_strategy.rb +24 -0
  77. data/lib/latinverb/tense_method_applicator/mutators/invariant/triplicate_and_pluralize_formatters.rb +26 -0
  78. data/lib/latinverb/tense_method_applicator/mutators/invariant.rb +65 -0
  79. data/lib/latinverb/tense_method_applicator/mutators/irregular/infinitives_builder.rb +35 -0
  80. data/lib/latinverb/tense_method_applicator/mutators/irregular/json_deserializer.rb +52 -0
  81. data/lib/latinverb/tense_method_applicator/mutators/irregular/json_revivifier.rb +48 -0
  82. data/lib/latinverb/tense_method_applicator/mutators/irregular/participles_builder.rb +35 -0
  83. data/lib/latinverb/tense_method_applicator/mutators/irregular/present_only_irregular_mask.rb +37 -0
  84. data/lib/latinverb/tense_method_applicator/mutators/irregular.rb +25 -0
  85. data/lib/latinverb/tense_method_applicator/mutators/present_only.rb +18 -0
  86. data/lib/latinverb/tense_method_applicator/mutators/regular.rb +17 -0
  87. data/lib/latinverb/tense_method_applicator/mutators/semideponent.rb +88 -0
  88. data/lib/latinverb/tense_method_applicator/perfect_tense_remover.rb +26 -0
  89. data/lib/latinverb/tense_method_applicator/second_builder.rb +105 -0
  90. data/lib/latinverb/tense_method_applicator/tense_methods_vectorizer.rb +73 -0
  91. data/lib/latinverb/tense_method_applicator/third_builder.rb +93 -0
  92. data/lib/latinverb/tense_method_applicator/thirdio_builder.rb +100 -0
  93. data/lib/latinverb/tense_method_applicator.rb +55 -0
  94. data/lib/latinverb/version.rb +2 -3
  95. data/lib/latinverb.rb +63 -419
  96. data/test/{testDeponentFirstConjugation.rb → integration/deponent_first_conjugation_test.rb} +1 -1
  97. data/test/{testDeponentFourthConjugation.rb → integration/deponent_fourth_conjugation_test.rb} +1 -1
  98. data/test/{testDeponentSecondConjugation.rb → integration/deponent_second_conjugation_test.rb} +1 -1
  99. data/test/{testDeponentThirdConjugation.rb → integration/deponent_third_conjugation_test.rb} +2 -2
  100. data/test/{testDeponentThirdIOConjugation.rb → integration/deponent_third_io_conjugation_test.rb} +1 -1
  101. data/test/{testFirstConjugation.rb → integration/first_conjugation_test.rb} +3 -7
  102. data/test/{testFreakishVerbs.rb → integration/freakish_vs.rb_test.rb} +4 -4
  103. data/test/{testIrregularSum.rb → integration/irregular_sum_test.rb} +1 -1
  104. data/test/{testIrregulars.rb → integration/irregulars_test.rb} +1 -1
  105. data/test/{testLatinVerb.rb → integration/latin_verb_test.rb} +5 -25
  106. data/test/{testThirdConjugation.rb → integration/third_conjugation_test.rb} +19 -21
  107. data/test/unit/latinverb_accessible_reader_test.rb +18 -0
  108. data/test/unit/principal_parts_extractor_test.rb +33 -0
  109. metadata +151 -79
  110. data/lib/latinverb/chart.rb +0 -94
  111. data/lib/linguistics/latin/verb/classification_types.rb +0 -61
  112. data/lib/linguistics/latin/verb/constants.rb +0 -201
  113. data/lib/linguistics/latin/verb/deponent_tense_methods.rb +0 -85
  114. data/lib/linguistics/latin/verb/imperative_block.rb +0 -118
  115. data/lib/linguistics/latin/verb/infinitive_block.rb +0 -39
  116. data/lib/linguistics/latin/verb/infinitives.rb +0 -212
  117. data/lib/linguistics/latin/verb/irregulars.rb +0 -4393
  118. data/lib/linguistics/latin/verb/latinverb/data.rb +0 -87
  119. data/lib/linguistics/latin/verb/latinverb/defective_checker.rb +0 -17
  120. data/lib/linguistics/latin/verb/latinverb/deponent.rb +0 -159
  121. data/lib/linguistics/latin/verb/latinverb/display.rb +0 -22
  122. data/lib/linguistics/latin/verb/latinverb/impersonal.rb +0 -34
  123. data/lib/linguistics/latin/verb/latinverb/irregular.rb +0 -83
  124. data/lib/linguistics/latin/verb/latinverb/latin_verb_type_evaluator.rb +0 -32
  125. data/lib/linguistics/latin/verb/latinverb/latinverb_classifier.rb +0 -100
  126. data/lib/linguistics/latin/verb/latinverb/latinverb_input_sanitizer.rb +0 -32
  127. data/lib/linguistics/latin/verb/latinverb/latinverb_pp_extractor.rb +0 -106
  128. data/lib/linguistics/latin/verb/latinverb/metaprogramming.rb +0 -80
  129. data/lib/linguistics/latin/verb/latinverb/semideponent.rb +0 -28
  130. data/lib/linguistics/latin/verb/latinverb/validation.rb +0 -42
  131. data/lib/linguistics/latin/verb/latinverb/verbvector_description.rb +0 -50
  132. data/lib/linguistics/latin/verb/participle_block.rb +0 -36
  133. data/lib/linguistics/latin/verb/participles.rb +0 -202
  134. data/lib/linguistics/latin/verb/phonographia.rb +0 -109
  135. data/lib/linguistics/latin/verb/supine.rb +0 -42
  136. data/lib/linguistics/latin/verb/tense_block.rb +0 -227
  137. data/lib/linguistics/latin/verb/tense_definitions/first.rb +0 -92
  138. data/lib/linguistics/latin/verb/tense_definitions/fourth.rb +0 -92
  139. data/lib/linguistics/latin/verb/tense_definitions/impersonal.rb +0 -25
  140. data/lib/linguistics/latin/verb/tense_definitions/invariant.rb +0 -613
  141. data/lib/linguistics/latin/verb/tense_definitions/irregular.rb +0 -82
  142. data/lib/linguistics/latin/verb/tense_definitions/second.rb +0 -97
  143. data/lib/linguistics/latin/verb/tense_definitions/third.rb +0 -86
  144. data/lib/linguistics/latin/verb/tense_definitions/third_io.rb +0 -91
  145. data/test/testDeserializeInfinitives.rb +0 -36
  146. /data/test/{testAmbiguousLookups.rb → integration/ambiguous_lookups_test.rb} +0 -0
  147. /data/test/{testClusterResolution.rb → integration/cluster_resolution_test.rb} +0 -0
  148. /data/test/{testDataStructures.rb → integration/data_structures_test.rb} +0 -0
  149. /data/test/{testDefectSemiImp.rb → integration/defect_semi_imp_test.rb} +0 -0
  150. /data/test/{testFourthConjugation.rb → integration/fourth_conjugation_test.rb} +0 -0
  151. /data/test/{testImperativeBlock.rb → integration/imperative_block_test.rb} +0 -0
  152. /data/test/{testMacronRules.rb → integration/macron_rules_test.rb} +0 -0
  153. /data/test/{testSecondConjugation.rb → integration/second_conjugation_test.rb} +0 -0
  154. /data/test/{testThirdIOConjugation.rb → integration/third_io_conjugation_test.rb} +0 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c7d01401c1e463c6685484ef6aed12e2ddb89f57
4
+ data.tar.gz: 90d118e985a430efb4f1b9c78c6c32224e5a3ade
5
+ SHA512:
6
+ metadata.gz: d0bd88ebc7d39429081475d0bc6491b2bb009edd706db40c3bc1670d41739e0428ec8fc920396cd7fd9d5637dc3beaf9ea21812506bc1abb3c6db910345a6c4e
7
+ data.tar.gz: a8515ecbadfbd60bd5148830997c8377219ae57b884cf3966e15f5d680e5f6598664510d726738f54320ccb3fa50baf594351b8d2d93fe5bf8d6024b1ab19d44
data/Gemfile CHANGED
@@ -5,4 +5,5 @@ gemspec
5
5
 
6
6
  group :development do
7
7
  gem 'autotest-standalone'
8
+ gem 'byebug'
8
9
  end
data/Gemfile.lock CHANGED
@@ -1,24 +1,46 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- latinverb (0.9.2)
4
+ latinverb (0.9.3)
5
+ activesupport
6
+ linguistics_latin
5
7
  macronconversions
8
+ rake
6
9
  rdoc
7
- verbvector
8
10
 
9
11
  GEM
10
12
  remote: http://rubygems.org/
11
13
  specs:
12
- autotest-standalone (4.5.10)
13
- json (1.7.5)
14
+ activesupport (4.0.0)
15
+ i18n (~> 0.6, >= 0.6.4)
16
+ minitest (~> 4.2)
17
+ multi_json (~> 1.3)
18
+ thread_safe (~> 0.1)
19
+ tzinfo (~> 0.3.37)
20
+ atomic (1.1.14)
21
+ autotest-standalone (4.5.11)
22
+ byebug (2.2.2)
23
+ columnize (~> 0.3.6)
24
+ debugger-linecache (~> 1.2.0)
25
+ columnize (0.3.6)
26
+ debugger-linecache (1.2.0)
27
+ i18n (0.6.5)
28
+ json (1.8.1)
29
+ linguistics_latin (0.0.1)
14
30
  macronconversions (0.0.1)
15
- rdoc (3.12)
31
+ minitest (4.7.5)
32
+ multi_json (1.8.2)
33
+ rake (10.1.0)
34
+ rdoc (4.0.1)
16
35
  json (~> 1.4)
17
- verbvector (0.0.1)
36
+ thread_safe (0.1.3)
37
+ atomic
38
+ tzinfo (0.3.38)
18
39
 
19
40
  PLATFORMS
20
41
  ruby
21
42
 
22
43
  DEPENDENCIES
23
44
  autotest-standalone
45
+ byebug
24
46
  latinverb!
data/README.markdown CHANGED
@@ -14,7 +14,7 @@ and get back `amaretur`.
14
14
  ### HANDLING AMBIGUITY
15
15
 
16
16
  LatinVerb also has tolerances for ambiguity. Where
17
- passive\_voice\_subjunctive\_mood\_imperfect\_tense\_third\_person\_singular\_number
17
+ `passive_voice_subjunctive_mood_imperfect_tense_third_person_singular_number`
18
18
  is considered a "full" vector that uniquely identifies one value, it is
19
19
  possible to pass "incomplete" vectors such as
20
20
  `passive_voice_subjunctive_mood_imperfect_tense_third_person` which
data/Rakefile CHANGED
@@ -13,5 +13,6 @@ end
13
13
 
14
14
  Rake::TestTask.new do |t|
15
15
  t.ruby_opts = [ '-rminitest/pride' ]
16
+ t.test_files = FileList['test/**/*test*.rb']
16
17
  t.verbose = true
17
18
  end
data/latinverb.gemspec CHANGED
@@ -20,7 +20,9 @@ Gem::Specification.new do |s|
20
20
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
21
21
  s.require_paths = ["lib"]
22
22
 
23
- s.add_dependency("macronconversions")
24
- s.add_dependency("verbvector")
25
- s.add_dependency("rdoc")
23
+ s.add_runtime_dependency("macronconversions")
24
+ s.add_runtime_dependency("linguistics_latin")
25
+ s.add_runtime_dependency("rdoc")
26
+ s.add_runtime_dependency("rake")
27
+ s.add_runtime_dependency("activesupport")
26
28
  end
@@ -0,0 +1,81 @@
1
+ module Linguistics
2
+ module Latin
3
+ module Verb
4
+ class LatinVerb
5
+ class ChartPresenter
6
+ def initialize(verb)
7
+ @verb = verb
8
+ end
9
+
10
+ def chart
11
+ f="%9s%15s%15s%15s\n"
12
+ f_subjunctive="%9s%15s%15s%15s%15s\n"
13
+ c_prep "Present System", [
14
+ @verb.active_voice_indicative_mood_present_tense,
15
+ @verb.active_voice_indicative_mood_imperfect_tense,
16
+ @verb.active_voice_indicative_mood_future_tense
17
+ ], %w/Present Imperfect Future/,f
18
+ puts "\n"
19
+ c_prep "Perfect System", [ @verb.active_voice_indicative_mood_perfect_tense,
20
+ @verb.active_voice_indicative_mood_pastperfect_tense,
21
+ @verb.active_voice_indicative_mood_futureperfect_tense
22
+ ], %w/Perfect Past-Perfect Future-Perfect/,f
23
+ puts "\n"
24
+ c_prep "Passive Present System", [
25
+ @verb.passive_voice_indicative_mood_present_tense,
26
+ @verb.passive_voice_indicative_mood_imperfect_tense,
27
+ @verb.passive_voice_indicative_mood_future_tense
28
+ ], %w/Present Imperfect Future/,f
29
+ puts "\n"
30
+ c_prep "Passive Perfect System", [ @verb.passive_voice_indicative_mood_perfect_tense,
31
+ @verb.passive_voice_indicative_mood_pastperfect_tense,
32
+ @verb.passive_voice_indicative_mood_futureperfect_tense
33
+ ], %w/Perfect Past-Perfect Future-Perfect/,f
34
+ puts "\n"
35
+
36
+
37
+ c_prep "Subjunctives", [ @verb.active_voice_subjunctive_mood_present_tense,
38
+ @verb.active_voice_subjunctive_mood_imperfect_tense,
39
+ @verb.active_voice_subjunctive_mood_perfect_tense,
40
+ @verb.active_voice_subjunctive_mood_pastperfect_tense
41
+ ], %w/Present Imperfect Perfect Past-Perfect/,f_subjunctive
42
+ puts "\n"
43
+ c_prep "Passive Subjunctives", [ @verb.active_voice_subjunctive_mood_present_tense,
44
+ @verb.active_voice_subjunctive_mood_imperfect_tense,
45
+ @verb.active_voice_subjunctive_mood_perfect_tense,
46
+ @verb.active_voice_subjunctive_mood_pastperfect_tense
47
+ ], %w/Present Imperfect Perfect Past-Perfect/,f_subjunctive
48
+ puts "\n"
49
+ puts "Participles"
50
+ @verb.methods.grep(/_participle$/).each do |p|
51
+ printf "%42s %42s\n", p.to_s.gsub('_', ' ').gsub(/\b\w/){$&.upcase}, @verb.send(p)
52
+ end
53
+ puts "\n"
54
+ puts "Infinitives"
55
+ @verb.methods.grep(/infinitive$/).each do |p|
56
+ printf "%42s %42s\n", (p.to_s.gsub('_', ' ').gsub(/\b\w/){$&.upcase}), @verb.send(p)
57
+ end
58
+ return nil
59
+ end
60
+
61
+ alias_method :c, :chart
62
+ private
63
+
64
+ def c_prep(heading, rays, subtitles, format_string)
65
+ puts heading
66
+ puts '=' * heading.length + "\n"
67
+ printf format_string, '', *subtitles
68
+ underbars = subtitles.map{|j| j.gsub!( /./, '=' )}
69
+ printf format_string, '', *underbars
70
+ vertical_transform( rays ).each{|a| printf format_string, *a}
71
+ end
72
+
73
+ def vertical_transform( opts = [] )
74
+ # Get the length of the first array to be verticalized
75
+ ['1st Sg.', '2nd Sg.', '3rd Sg.','1st Pl.', '2nd Pl.', '3rd Pl.'].zip(*opts)
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,19 @@
1
+ module Linguistics
2
+ module Latin
3
+ module Verb
4
+ class LatinVerb
5
+ class LatinVerbClassifier
6
+ class DefectiveVerbClassificationStrategy < VerbClassificationStrategy
7
+ def self.classification
8
+ Classification::Defective
9
+ end
10
+
11
+ def applicable?
12
+ Linguistics::Latin::Verb::DEFECTIVE_VERBS.member? first_pres
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ module Linguistics
2
+ module Latin
3
+ module Verb
4
+ class LatinVerb
5
+ class LatinVerbClassifier
6
+ class DeponentVerbClassificationStrategy < VerbClassificationStrategy
7
+ def self.classification
8
+ return Classification::Deponent
9
+ end
10
+
11
+ def applicable?
12
+ infinitive =~ /ī$/ && first_pres =~ /r$/
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ module Linguistics
2
+ module Latin
3
+ module Verb
4
+ class LatinVerb
5
+ class LatinVerbClassifier
6
+ class ImpersonalVerbClassificationStrategy < VerbClassificationStrategy
7
+ def self.classification
8
+ Classification::Impersonal
9
+ end
10
+
11
+ def applicable?
12
+ Linguistics::Latin::Verb::IMPERSONAL_VERBS.member?(input)
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ module Linguistics
2
+ module Latin
3
+ module Verb
4
+ class LatinVerb
5
+ class LatinVerbClassifier
6
+ class IrregularVerbClassificationStrategy < VerbClassificationStrategy
7
+ def self.classification
8
+ Classification::Irregular
9
+ end
10
+
11
+ def applicable?
12
+ Linguistics::Latin::Verb::IRREGULAR_VERBS.member? first_pres
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,21 @@
1
+ require 'latinverb/components/present_only_checker'
2
+
3
+ module Linguistics
4
+ module Latin
5
+ module Verb
6
+ class LatinVerb
7
+ class LatinVerbClassifier
8
+ class PresentonlyVerbClassificationStrategy < VerbClassificationStrategy
9
+ def self.classification
10
+ Classification::PresentOnly
11
+ end
12
+
13
+ def applicable?
14
+ PresentOnlyChecker.new(input).present_only?
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,19 @@
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
@@ -0,0 +1,19 @@
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
@@ -0,0 +1,31 @@
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
@@ -0,0 +1,20 @@
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
@@ -0,0 +1,76 @@
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
@@ -0,0 +1,40 @@
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
@@ -0,0 +1,50 @@
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
@@ -0,0 +1,58 @@
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
@@ -0,0 +1,42 @@
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
@@ -0,0 +1,32 @@
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