latinverb 0.9.2 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +4 -1
- data/Gemfile.lock +24 -0
- data/Guardfile +10 -0
- data/README.markdown +1 -1
- data/Rakefile +12 -9
- data/latinverb.gemspec +4 -0
- data/lib/latinverb/chart.rb +5 -5
- data/lib/latinverb/version.rb +1 -1
- data/lib/latinverb.rb +266 -534
- data/lib/linguistics/latin/verb/classification_types.rb +19 -17
- data/lib/linguistics/latin/verb/constants.rb +14 -14
- data/lib/linguistics/latin/verb/deponent_tense_methods.rb +8 -21
- data/lib/linguistics/latin/verb/imperative_block.rb +118 -0
- data/lib/linguistics/latin/verb/infinitive_block.rb +39 -0
- data/lib/linguistics/latin/verb/infinitives.rb +181 -181
- data/lib/linguistics/latin/verb/irregulars.rb +74 -74
- data/lib/linguistics/latin/verb/latinverb/classmethods.rb +36 -117
- data/lib/linguistics/latin/verb/latinverb/data.rb +12 -15
- data/lib/linguistics/latin/verb/latinverb/defective_checker.rb +17 -0
- data/lib/linguistics/latin/verb/latinverb/deponent.rb +159 -0
- data/lib/linguistics/latin/verb/latinverb/display.rb +1 -2
- data/lib/linguistics/latin/verb/latinverb/impersonal.rb +34 -0
- data/lib/linguistics/latin/verb/latinverb/irregular.rb +83 -0
- data/lib/linguistics/latin/verb/latinverb/latin_verb_type_evaluator.rb +32 -0
- data/lib/linguistics/latin/verb/latinverb/latinverb_classifier.rb +100 -0
- data/lib/linguistics/latin/verb/latinverb/latinverb_input_sanitizer.rb +32 -0
- data/lib/linguistics/latin/verb/latinverb/latinverb_pp_extractor.rb +106 -0
- data/lib/linguistics/latin/verb/latinverb/metaprogramming.rb +30 -29
- data/lib/linguistics/latin/verb/latinverb/semideponent.rb +28 -0
- data/lib/linguistics/latin/verb/latinverb/validation.rb +5 -29
- data/lib/linguistics/latin/verb/latinverb/verbvector_description.rb +50 -0
- data/lib/linguistics/latin/verb/participle_block.rb +36 -0
- data/lib/linguistics/latin/verb/participles.rb +25 -25
- data/lib/linguistics/latin/verb/phonographia.rb +51 -51
- data/lib/linguistics/latin/verb/supine.rb +6 -6
- data/lib/linguistics/latin/verb/tense_block.rb +227 -0
- data/lib/linguistics/latin/verb/tense_definitions/first.rb +92 -0
- data/lib/linguistics/latin/verb/tense_definitions/fourth.rb +92 -0
- data/lib/linguistics/latin/verb/tense_definitions/impersonal.rb +25 -0
- data/lib/linguistics/latin/verb/tense_definitions/invariant.rb +613 -0
- data/lib/linguistics/latin/verb/tense_definitions/irregular.rb +82 -0
- data/lib/linguistics/latin/verb/tense_definitions/second.rb +97 -0
- data/lib/linguistics/latin/verb/tense_definitions/third.rb +86 -0
- data/lib/linguistics/latin/verb/tense_definitions/third_io.rb +91 -0
- data/test/testClusterResolution.rb +0 -1
- data/test/testDataStructures.rb +8 -5
- data/test/testDefectSemiImp.rb +9 -10
- data/test/testDeponentFirstConjugation.rb +2 -2
- data/test/testDeponentFourthConjugation.rb +2 -2
- data/test/testDeponentSecondConjugation.rb +2 -2
- data/test/testDeponentThirdConjugation.rb +2 -2
- data/test/testDeponentThirdIOConjugation.rb +2 -2
- data/test/testDeserializeInfinitives.rb +2 -4
- data/test/testFirstConjugation.rb +53 -53
- data/test/testFourthConjugation.rb +11 -11
- data/test/testFreakishVerbs.rb +12 -11
- data/test/testIrregulars.rb +24 -23
- data/test/testLatinVerb.rb +46 -55
- data/test/testSecondConjugation.rb +27 -27
- data/test/testThirdConjugation.rb +14 -14
- data/test/testThirdIOConjugation.rb +13 -13
- metadata +95 -53
- data/lib/linguistics/latin/verb/latinverb/auxiliary_classes.rb +0 -208
- data/lib/linguistics/latin/verb/tense_methods.rb +0 -950
@@ -0,0 +1,100 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# vim: set fdm=marker tw=80 sw=2:
|
3
|
+
|
4
|
+
module Linguistics
|
5
|
+
# Generalized module for handling lingustics related to Latin
|
6
|
+
module Latin
|
7
|
+
# Generalized module for handling lingustics related to Latin's verbal aspects
|
8
|
+
module Verb
|
9
|
+
class LatinVerb
|
10
|
+
### {{{
|
11
|
+
#
|
12
|
+
# == ARGUMENTS
|
13
|
+
#
|
14
|
+
# * s :: a "four principal parts" string whence can be derived
|
15
|
+
# the first person singular present indicative as well as the
|
16
|
+
# infinitive
|
17
|
+
#
|
18
|
+
# == RETURNS
|
19
|
+
#
|
20
|
+
# The classification, a subclass of VerbType
|
21
|
+
#
|
22
|
+
# == PURPOSE
|
23
|
+
#
|
24
|
+
# Given the principal parts as a string, decide which conjuation is
|
25
|
+
# in play
|
26
|
+
#
|
27
|
+
#
|
28
|
+
### }}}
|
29
|
+
class LatinVerbClassifier# {{{
|
30
|
+
attr_reader :classification
|
31
|
+
|
32
|
+
def initialize(input)
|
33
|
+
@classification = self.classify input
|
34
|
+
end
|
35
|
+
|
36
|
+
def classify(s)
|
37
|
+
|
38
|
+
divided_string = s.split( /\s+/ )
|
39
|
+
|
40
|
+
first_pres = divided_string[0] || ''
|
41
|
+
infinitive = divided_string[1] || ''
|
42
|
+
|
43
|
+
return Linguistics::Latin::Verb::Classification::Defective if
|
44
|
+
Linguistics::Latin::Verb::LatinVerb::DEFECTIVE_VERBS.member? first_pres
|
45
|
+
|
46
|
+
return Linguistics::Latin::Verb::Classification::Irregular if
|
47
|
+
Linguistics::Latin::Verb::LatinVerb::IRREGULAR_VERBS.member? first_pres
|
48
|
+
|
49
|
+
return Linguistics::Latin::Verb::Classification::Semideponent if
|
50
|
+
Linguistics::Latin::Verb::LatinVerb::SEMI_DEPONENTS.keys.any?{ |k| first_pres=~/#{k}$/} &&
|
51
|
+
s !~ /PreventDeponentInfiniteRegress/
|
52
|
+
|
53
|
+
return Linguistics::Latin::Verb::Classification::Impersonal if
|
54
|
+
Linguistics::Latin::Verb::LatinVerb::IMPERSONAL_VERBS.member? s
|
55
|
+
|
56
|
+
# Very irregular irregulars, A&G206, e/f
|
57
|
+
return Linguistics::Latin::Verb::Classification::Irregular if
|
58
|
+
s =~ %r'^(aiō|quaesō|ovāre)$'
|
59
|
+
|
60
|
+
return Linguistics::Latin::Verb::Classification::Deponent if
|
61
|
+
(infinitive =~ /ī$/ and first_pres =~ /r$/)
|
62
|
+
|
63
|
+
return Linguistics::Latin::Verb::Classification::Regular
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
def set_as_defective
|
68
|
+
unless @classification == Linguistics::Latin::Verb::Classification::Impersonal
|
69
|
+
@classification = Linguistics::Latin::Verb::Classification::PresentOnly
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def present_only?
|
74
|
+
@present_only ||= ( @classification == Linguistics::Latin::Verb::Classification::PresentOnly )
|
75
|
+
end
|
76
|
+
|
77
|
+
def deponent?
|
78
|
+
@deponent ||= (@classification == Linguistics::Latin::Verb::Classification::Deponent)
|
79
|
+
end
|
80
|
+
|
81
|
+
def semideponent?
|
82
|
+
@semideponent ||= (@classification == Linguistics::Latin::Verb::Classification::Semideponent)
|
83
|
+
end
|
84
|
+
|
85
|
+
def impersonal?
|
86
|
+
@impersonal ||= (@classification == Linguistics::Latin::Verb::Classification::Impersonal)
|
87
|
+
end
|
88
|
+
|
89
|
+
def irregular?
|
90
|
+
@irregular = @classification == Linguistics::Latin::Verb::Classification::Irregular
|
91
|
+
end
|
92
|
+
|
93
|
+
def regular?
|
94
|
+
@regular = @classification == Linguistics::Latin::Verb::Classification::Regular
|
95
|
+
end
|
96
|
+
end# }}}
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# vim: set fdm=marker tw=80 sw=2:
|
3
|
+
|
4
|
+
module Linguistics
|
5
|
+
# Generalized module for handling lingustics related to Latin
|
6
|
+
module Latin
|
7
|
+
# Generalized module for handling lingustics related to Latin's verbal aspects
|
8
|
+
module Verb
|
9
|
+
class LatinVerb
|
10
|
+
class LatinVerbInitializationError < Exception; end
|
11
|
+
class LatinVerbInputSanitizer# {{{
|
12
|
+
def initialize(raw_data)
|
13
|
+
@raw_data = raw_data.dup
|
14
|
+
|
15
|
+
unless ( raw_data.is_a? String )
|
16
|
+
raw_data_type = raw_data.class.to_s.downcase
|
17
|
+
method_prefix = 'construct_original_string_for_'
|
18
|
+
mutator = ( method_prefix + raw_data_type ).to_sym
|
19
|
+
raw_data = send(mutator, raw_data)
|
20
|
+
end
|
21
|
+
|
22
|
+
@sanitized_data = raw_data
|
23
|
+
end
|
24
|
+
|
25
|
+
def to_s
|
26
|
+
return @sanitized_data
|
27
|
+
end
|
28
|
+
end# }}}
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# vim: set fdm=marker tw=80 sw=2:
|
3
|
+
|
4
|
+
module Linguistics
|
5
|
+
# Generalized module for handling lingustics related to Latin
|
6
|
+
module Latin
|
7
|
+
# Generalized module for handling lingustics related to Latin's verbal aspects
|
8
|
+
module Verb
|
9
|
+
class LatinVerb
|
10
|
+
class LatinVerbPPExtractor# {{{
|
11
|
+
attr_reader :passive_perfect_participle, :first_person_perfect, :present_active_infinitive, :first_person_singular
|
12
|
+
|
13
|
+
class << self# {{{
|
14
|
+
|
15
|
+
def calculate_stem(present_active_infinitive, first_person_singular)# {{{
|
16
|
+
if present_active_infinitive =~ /āre$/
|
17
|
+
return present_active_infinitive.gsub(/(.*)āre$/,'\\1ā')
|
18
|
+
end
|
19
|
+
if present_active_infinitive =~ /ēre$/
|
20
|
+
return present_active_infinitive.gsub(/(.*)ēre$/,'\\1ē')
|
21
|
+
end
|
22
|
+
if present_active_infinitive =~ /ere$/
|
23
|
+
if first_person_singular =~ /iō$/
|
24
|
+
return present_active_infinitive.gsub(/(.*)ere$/,'\\1')
|
25
|
+
else
|
26
|
+
return present_active_infinitive.gsub(/(.*)ere$/,'\\1')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
if present_active_infinitive =~ /īre$/
|
30
|
+
return present_active_infinitive.gsub(/(.*)īre$/,'\\1')
|
31
|
+
end
|
32
|
+
end# }}}
|
33
|
+
|
34
|
+
def derive_parts_from_given_string(s)# {{{
|
35
|
+
s.split(/\s+/)
|
36
|
+
end# }}}
|
37
|
+
|
38
|
+
def calculate_participial_stem(present_active_infinitive, first_person_singular)
|
39
|
+
if present_active_infinitive.to_s =~ /(.*ā)re$/
|
40
|
+
return $1
|
41
|
+
end
|
42
|
+
|
43
|
+
if present_active_infinitive.to_s =~ /(.*ē)re$/
|
44
|
+
return $1
|
45
|
+
end
|
46
|
+
|
47
|
+
if present_active_infinitive.to_s =~ /(.*)ere$/
|
48
|
+
match=$1
|
49
|
+
if first_person_singular =~ /iō/
|
50
|
+
return match + "iē"
|
51
|
+
else
|
52
|
+
return match + "e"
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
if present_active_infinitive.to_s =~ /(.*)īre$/
|
57
|
+
return $1 + "iē"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end# }}}
|
61
|
+
|
62
|
+
def initialize(input_string, classification)# {{{
|
63
|
+
@data_string = input_string
|
64
|
+
@_classification = classification
|
65
|
+
|
66
|
+
non_defective = ( classified_as.deponent? or
|
67
|
+
classified_as.semideponent? or
|
68
|
+
classified_as.impersonal? )
|
69
|
+
unless non_defective
|
70
|
+
@principal_parts = self.class.derive_parts_from_given_string input_string
|
71
|
+
@first_person_singular, @present_active_infinitive,
|
72
|
+
@first_person_perfect, @passive_perfect_participle = @principal_parts
|
73
|
+
else
|
74
|
+
unless classified_as.impersonal?
|
75
|
+
@deponent_proxy = Linguistics::Latin::Verb::LatinVerb.create_pseudo_active_mask_for_deponent(input_string)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end# }}}
|
79
|
+
|
80
|
+
def participial_stem
|
81
|
+
@participial_stem ||= self.class.calculate_participial_stem(@present_active_infinitive, @first_person_singular)
|
82
|
+
end
|
83
|
+
|
84
|
+
def principal_parts
|
85
|
+
@principal_parts
|
86
|
+
end
|
87
|
+
|
88
|
+
def stem
|
89
|
+
@stem ||= self.class.calculate_stem(present_active_infinitive, first_person_singular)
|
90
|
+
end
|
91
|
+
|
92
|
+
def classification
|
93
|
+
@_classification
|
94
|
+
end
|
95
|
+
alias :classified_as :classification
|
96
|
+
|
97
|
+
|
98
|
+
end
|
99
|
+
|
100
|
+
def to_a
|
101
|
+
@principal_parts
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
@@ -1,5 +1,7 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
module Linguistics
|
2
|
+
module Latin
|
3
|
+
module Verb
|
4
|
+
class LatinVerb
|
3
5
|
=begin rdoc
|
4
6
|
#--
|
5
7
|
# The purpose of this module is to contain the metaprogramming modules
|
@@ -7,10 +9,6 @@
|
|
7
9
|
# ++
|
8
10
|
=end
|
9
11
|
|
10
|
-
module Linguistics
|
11
|
-
module Latin
|
12
|
-
module Verb
|
13
|
-
class LatinVerb
|
14
12
|
|
15
13
|
=begin rdoc
|
16
14
|
|
@@ -38,25 +36,21 @@ specifier, thus all 5/5 components of the fully-qualified vector can result in
|
|
38
36
|
unique match.
|
39
37
|
|
40
38
|
=end
|
41
|
-
def method_missing(
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
super
|
56
|
-
end
|
57
|
-
end
|
39
|
+
def method_missing(method_name, *args ) # :nodoc:
|
40
|
+
method_name_components = method_name.to_s.split('_')
|
41
|
+
|
42
|
+
tense_method = Array(method_name_components[0..5]).join('_')
|
43
|
+
vector_specifier = Array(method_name_components[6..-1]).join('_')
|
44
|
+
|
45
|
+
raise RuntimeError, "Lookup on #{method_name} failed" if tense_method.nil? || vector_specifier.nil?
|
46
|
+
|
47
|
+
if self.respond_to?(tense_method.to_sym)
|
48
|
+
tense_block = send(tense_method.to_sym)
|
49
|
+
raise RuntimeError, "Call for #{tense_method} failed" if tense_block.nil?
|
50
|
+
tense_block.send(vector_specifier.to_sym)
|
51
|
+
else
|
52
|
+
super
|
58
53
|
end
|
59
|
-
super
|
60
54
|
end
|
61
55
|
|
62
56
|
##
|
@@ -66,11 +60,18 @@ unique match.
|
|
66
60
|
# If it's in +respondable_methods+, we return true.
|
67
61
|
#
|
68
62
|
##
|
69
|
-
def
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
63
|
+
def respond_to_missing?(method_name, include_private = false) #:nodoc:
|
64
|
+
components = method_name.to_s.split('_')
|
65
|
+
tense_method = components[0..5].join('_').to_sym
|
66
|
+
|
67
|
+
return false unless @tense_list.nil? || @tense_list.include?( tense_method.to_s )
|
68
|
+
|
69
|
+
if components.length > 6
|
70
|
+
tb = self.send(tense_method)
|
71
|
+
vector_call = components[6..-1].join('_').to_sym
|
72
|
+
tb.class.instance_method(vector_call)
|
73
|
+
end
|
74
|
+
|
74
75
|
end
|
75
76
|
end
|
76
77
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
module Linguistics
|
3
|
+
module Latin
|
4
|
+
module Verb
|
5
|
+
class LatinVerb
|
6
|
+
module Semideponent
|
7
|
+
def self.extended(extending_instance)
|
8
|
+
extending_instance.instance_eval do
|
9
|
+
@proxy_verb_string = Linguistics::Latin::Verb::LatinVerb.create_pseudo_active_mask_for_deponent @original_string
|
10
|
+
@proxyVerb = Linguistics::Latin::Verb::LatinVerb.new @proxy_verb_string
|
11
|
+
apply_semi_deponent_masking
|
12
|
+
end
|
13
|
+
end
|
14
|
+
# Previously @deponent and @semideponent followed the same paths,
|
15
|
+
# but in semideponents, the "present system" is handled as normal
|
16
|
+
# (completed by _add_vector_methods, supra). We need only mask, as
|
17
|
+
# A&G #192 says: "the completed methods" i.e. the perfect system.
|
18
|
+
def apply_semi_deponent_masking
|
19
|
+
self.singleton_class.class_eval do
|
20
|
+
include Linguistics::Latin::Verb::DeponentTenseMethods
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
@@ -4,7 +4,7 @@ module Linguistics
|
|
4
4
|
module Latin
|
5
5
|
module Verb
|
6
6
|
##
|
7
|
-
# == NAME
|
7
|
+
# == NAME
|
8
8
|
#
|
9
9
|
# Validation
|
10
10
|
#
|
@@ -15,7 +15,6 @@ module Linguistics
|
|
15
15
|
#
|
16
16
|
##
|
17
17
|
module Validation
|
18
|
-
|
19
18
|
##
|
20
19
|
#
|
21
20
|
# == DESCRIPTION
|
@@ -24,7 +23,7 @@ module Linguistics
|
|
24
23
|
# LatinVerb.initialize) for basic sanity.
|
25
24
|
#
|
26
25
|
# Here are its basic truths
|
27
|
-
#
|
26
|
+
#
|
28
27
|
# 1. Get +@original_string+ as an iVar
|
29
28
|
# 1. Derive a classification (+@classification+) from the string
|
30
29
|
# 1. Determine whether the string qualifies the verb as irregular
|
@@ -32,32 +31,9 @@ module Linguistics
|
|
32
31
|
#
|
33
32
|
##
|
34
33
|
def valid?
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
@classification = Linguistics::Latin::Verb::LatinVerb.classify(os)
|
39
|
-
@irregular =
|
40
|
-
@classification == Linguistics::Latin::Verb::VerbTypes::Irregular ?
|
41
|
-
true : false
|
42
|
-
unless @irregular
|
43
|
-
@stem ||= self.class.calculate_stem os.split(/\s+/)[1]
|
44
|
-
@deponent = (@classification == Linguistics::Latin::Verb::VerbTypes::Deponent) ?
|
45
|
-
true : false
|
46
|
-
@semideponent = (@classification == Linguistics::Latin::Verb::VerbTypes::Semideponent) ?
|
47
|
-
true : false
|
48
|
-
@impersonal= (@classification == Linguistics::Latin::Verb::VerbTypes::Impersonal) ?
|
49
|
-
true : false
|
50
|
-
end
|
51
|
-
rescue RuntimeError => detail
|
52
|
-
STDERR.puts "WARNING: Improper use of rescue for decision structure in latinverb_validation"
|
53
|
-
@irregular = true
|
54
|
-
rescue Exception => e
|
55
|
-
@classification_error = lambda do
|
56
|
-
raise e
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
return true
|
34
|
+
!@original_string.nil? &&
|
35
|
+
!classification.nil? &&
|
36
|
+
( irregular? ? true : !stem.nil? )
|
61
37
|
end
|
62
38
|
end
|
63
39
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
#
|
3
|
+
|
4
|
+
module Linguistics
|
5
|
+
# Generalized module for handling linguistics related to Latin
|
6
|
+
module Latin
|
7
|
+
# Generalized module for handling linguistics related to Latin's verbal aspects
|
8
|
+
module Verb
|
9
|
+
class LatinVerb
|
10
|
+
LATIN_VERBVECTOR_DESCRIPTION = Proc.new do
|
11
|
+
language :Latin do
|
12
|
+
all_vectors :start_with do
|
13
|
+
{
|
14
|
+
:voice => %w(active passive),
|
15
|
+
:mood => %w(indicative subjunctive imperative)
|
16
|
+
}
|
17
|
+
end
|
18
|
+
vectors_that(/.*_indicative_mood/) do
|
19
|
+
{
|
20
|
+
:tense => %w(present imperfect future
|
21
|
+
perfect pastperfect futureperfect)
|
22
|
+
}
|
23
|
+
end
|
24
|
+
vectors_that(/.*_subjunctive_mood/) do
|
25
|
+
{
|
26
|
+
:tense => %w(present imperfect
|
27
|
+
perfect pastperfect)
|
28
|
+
}
|
29
|
+
end
|
30
|
+
vectors_that(/.*_imperative_mood/) do
|
31
|
+
{
|
32
|
+
:tense => %w(present future)
|
33
|
+
}
|
34
|
+
end
|
35
|
+
all_vectors :end_with do
|
36
|
+
{
|
37
|
+
:person => %w(first second third),
|
38
|
+
:number => %w(singular plural)
|
39
|
+
}
|
40
|
+
end
|
41
|
+
exception :remove, :passive_voice_imperative_mood_present_tense
|
42
|
+
exception :remove, :passive_voice_imperative_mood_future_tense
|
43
|
+
cluster_on :tense, "as method", :tense_list
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Linguistics
|
2
|
+
module Latin
|
3
|
+
module Verb
|
4
|
+
class ParticipleBlock
|
5
|
+
attr_reader :participle_methods
|
6
|
+
|
7
|
+
def initialize(s)
|
8
|
+
raise "ParticipleBlock instantiation argument was nil!" if s.nil?
|
9
|
+
|
10
|
+
if s.is_a? Hash
|
11
|
+
@participle_methods = s.keys
|
12
|
+
end
|
13
|
+
|
14
|
+
@participle_methods.each do |k|
|
15
|
+
v=s[k]
|
16
|
+
singleton_class.class_eval do
|
17
|
+
define_method k.to_sym do
|
18
|
+
return v
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
##
|
25
|
+
#
|
26
|
+
# Required for deserialization
|
27
|
+
#
|
28
|
+
##
|
29
|
+
def self.json_create(o)
|
30
|
+
new(o['data'])
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
@@ -3,9 +3,9 @@
|
|
3
3
|
require 'latinverb'
|
4
4
|
require 'linguistics/latin/verb/phonographia'
|
5
5
|
|
6
|
-
module Linguistics
|
7
|
-
module Latin
|
8
|
-
module Verb
|
6
|
+
module Linguistics
|
7
|
+
module Latin
|
8
|
+
module Verb
|
9
9
|
##
|
10
10
|
# == NAME
|
11
11
|
#
|
@@ -31,7 +31,7 @@ module Linguistics
|
|
31
31
|
# declension used only in the oblique cases of hte singular.
|
32
32
|
# c. The Supine: this is in form a verbal noun of the fourth
|
33
33
|
# declension in the accusative (-um) and dative or ablative (-ū)
|
34
|
-
# singular
|
34
|
+
# singular
|
35
35
|
# ...
|
36
36
|
#
|
37
37
|
##
|
@@ -59,9 +59,9 @@ module Linguistics
|
|
59
59
|
#
|
60
60
|
###
|
61
61
|
def present_active_participle
|
62
|
-
raise "Participial stem was nil" if
|
62
|
+
raise "Participial stem was nil" if participial_stem.nil?
|
63
63
|
endings=%w(ns ntis)
|
64
|
-
return endings.collect{ |x| Linguistics::Latin::Phonographia.fix_macrons(
|
64
|
+
return endings.collect{ |x| Linguistics::Latin::Phonographia.fix_macrons(participial_stem+x.chomp)}.join(', ')
|
65
65
|
end
|
66
66
|
|
67
67
|
##
|
@@ -83,10 +83,10 @@ module Linguistics
|
|
83
83
|
###
|
84
84
|
def future_active_participle
|
85
85
|
# In case we have an irregular, or somehow already have a /ūrus$/ we shouldn't do this
|
86
|
-
mybase = (@
|
87
|
-
@
|
86
|
+
mybase = (@passive_perfect_participle =~ /ūru.$/) ?
|
87
|
+
@passive_perfect_participle.gsub(/u[sm]$/,'')
|
88
88
|
:
|
89
|
-
@
|
89
|
+
@passive_perfect_participle.gsub(/u[sm]$/, "ūr")
|
90
90
|
|
91
91
|
singular_endings=%w(us a um)
|
92
92
|
return singular_endings.collect{|x| mybase+"#{x}".chomp}.join(', ')
|
@@ -117,7 +117,7 @@ module Linguistics
|
|
117
117
|
#
|
118
118
|
###
|
119
119
|
def perfect_passive_participle
|
120
|
-
mybase=@
|
120
|
+
mybase=@passive_perfect_participle.sub(/u[sm]$/,'')
|
121
121
|
singular_endings=%w(us a um)
|
122
122
|
return singular_endings.collect{|x| mybase+"#{x}".chomp}.join(', ')
|
123
123
|
end
|
@@ -138,7 +138,7 @@ module Linguistics
|
|
138
138
|
#
|
139
139
|
###
|
140
140
|
def future_passive_participle
|
141
|
-
mybase =
|
141
|
+
mybase = participial_stem+"nd"
|
142
142
|
singular_endings=%w(us a um)
|
143
143
|
return singular_endings.collect{|x|Linguistics::Latin::Phonographia.fix_macrons( mybase+"#{x}".chomp)}.join(', ')
|
144
144
|
end
|
@@ -147,11 +147,11 @@ module Linguistics
|
|
147
147
|
#
|
148
148
|
# === GRAMMATICAL FUNCTION
|
149
149
|
#
|
150
|
-
# A&G, 158,d.
|
150
|
+
# A&G, 158,d.
|
151
151
|
#
|
152
|
-
# The Gerundive (ending in -ndus) has two uses:
|
152
|
+
# The Gerundive (ending in -ndus) has two uses:
|
153
153
|
#
|
154
|
-
# 1. ...an adjective implying obligation...
|
154
|
+
# 1. ...an adjective implying obligation...
|
155
155
|
#
|
156
156
|
# 2. In the oblique cases the Gerundive commonly has the same meaning as
|
157
157
|
# the Gerund ... for examples see sec. 503
|
@@ -179,10 +179,10 @@ module Linguistics
|
|
179
179
|
#
|
180
180
|
# Gerundive: verbal achective
|
181
181
|
# gerund: verbal noun
|
182
|
-
#
|
182
|
+
#
|
183
183
|
# gerund only has oblique
|
184
184
|
# gerundive is passive in meaning, gerund is active:
|
185
|
-
#
|
185
|
+
#
|
186
186
|
# A FUNNY THING I ALWAYS FORGET:
|
187
187
|
# studium legeni libros ==> studium librorum legendorum
|
188
188
|
# discimus legendo libros ==> discimus libris legendis
|
@@ -190,13 +190,13 @@ module Linguistics
|
|
190
190
|
# -- Source, Wheelock
|
191
191
|
#++
|
192
192
|
##
|
193
|
-
#alias_method :gerund, :gerundive
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
end
|
193
|
+
#alias_method :gerund, :gerundive
|
194
|
+
def gerund
|
195
|
+
b = gerundive.sub( /.*\s+(.*)um.*$/, "\\1" )
|
196
|
+
b += "ī, ō, etc."
|
197
|
+
return b
|
198
|
+
end
|
199
|
+
end
|
200
|
+
end
|
201
|
+
end
|
202
202
|
end
|