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
@@ -1,80 +0,0 @@
|
|
1
|
-
module Linguistics
|
2
|
-
module Latin
|
3
|
-
module Verb
|
4
|
-
class LatinVerb
|
5
|
-
=begin rdoc
|
6
|
-
#--
|
7
|
-
# The purpose of this module is to contain the metaprogramming modules
|
8
|
-
# method_missing and respond_to? in a place that's nice and neat.
|
9
|
-
# ++
|
10
|
-
=end
|
11
|
-
|
12
|
-
|
13
|
-
=begin rdoc
|
14
|
-
|
15
|
-
=== DESCRIPTION
|
16
|
-
|
17
|
-
Override of the method_missing method. A lot of the magic of LatinVerb
|
18
|
-
happens here. This method has deep interactoion with the Verbvector results
|
19
|
-
called as part of the LatinVerb.initialize call path.
|
20
|
-
|
21
|
-
=== INTERNALS
|
22
|
-
|
23
|
-
Given a symbol that is undefined, we look to +@tense_list+ first. The typical
|
24
|
-
case would be a call on a 3/5ths vector identification. Therefore if the call
|
25
|
-
is pure nonsense, the symbol will not be found on the first evaluation and go
|
26
|
-
to super. Assuming that the symbol IS a partial vector call, it will match
|
27
|
-
through the iteration of the values in +@tense_list+. Based on the match, two
|
28
|
-
Regexp values are derived:
|
29
|
-
|
30
|
-
* the first 3/5ths (enough to get a TenseBlock), called a +tense_method+
|
31
|
-
* the last 2/5ths (enough to specify a value out of that TenseBlock), called a +vector_specifier+
|
32
|
-
|
33
|
-
Given those two names, the tense_method is called on the LatinVerb with +send+
|
34
|
-
and _that_ resultant value, a TenseBlock, undergoes a +send+ call to the
|
35
|
-
specifier, thus all 5/5 components of the fully-qualified vector can result in
|
36
|
-
unique match.
|
37
|
-
|
38
|
-
=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
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
##
|
57
|
-
#
|
58
|
-
# We override respond_to so that we respond to the normal object
|
59
|
-
# models as well as accept the method_missing utilized names as well.
|
60
|
-
# If it's in +respondable_methods+, we return true.
|
61
|
-
#
|
62
|
-
##
|
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
|
-
|
75
|
-
end
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
@@ -1,28 +0,0 @@
|
|
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
|
-
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
module Linguistics
|
4
|
-
module Latin
|
5
|
-
module Verb
|
6
|
-
##
|
7
|
-
# == NAME
|
8
|
-
#
|
9
|
-
# Validation
|
10
|
-
#
|
11
|
-
# == DESCRIPTION
|
12
|
-
#
|
13
|
-
# This module contains the validity testing methods, when mixed into a
|
14
|
-
# LatinVerb, will provide it the ability to ensure its own sanity.
|
15
|
-
#
|
16
|
-
##
|
17
|
-
module Validation
|
18
|
-
##
|
19
|
-
#
|
20
|
-
# == DESCRIPTION
|
21
|
-
#
|
22
|
-
# This performs the basic task of evaluating the given string (cf.
|
23
|
-
# LatinVerb.initialize) for basic sanity.
|
24
|
-
#
|
25
|
-
# Here are its basic truths
|
26
|
-
#
|
27
|
-
# 1. Get +@original_string+ as an iVar
|
28
|
-
# 1. Derive a classification (+@classification+) from the string
|
29
|
-
# 1. Determine whether the string qualifies the verb as irregular
|
30
|
-
# 1. Identify a stem (+@stem+), provided the verb is regular
|
31
|
-
#
|
32
|
-
##
|
33
|
-
def valid?
|
34
|
-
!@original_string.nil? &&
|
35
|
-
!classification.nil? &&
|
36
|
-
( irregular? ? true : !stem.nil? )
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
@@ -1,50 +0,0 @@
|
|
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
|
-
|
@@ -1,36 +0,0 @@
|
|
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
|
-
|
@@ -1,202 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
require 'latinverb'
|
4
|
-
require 'linguistics/latin/verb/phonographia'
|
5
|
-
|
6
|
-
module Linguistics
|
7
|
-
module Latin
|
8
|
-
module Verb
|
9
|
-
##
|
10
|
-
# == NAME
|
11
|
-
#
|
12
|
-
# Participles
|
13
|
-
#
|
14
|
-
# == DESCRIPTION
|
15
|
-
#
|
16
|
-
# This module contains the methods that, when mixed into a LatinVerb,
|
17
|
-
# will provide it the ability to resolve its participles (verbal
|
18
|
-
# adjectives).
|
19
|
-
#
|
20
|
-
# == REFERENCE
|
21
|
-
#
|
22
|
-
# Allen and Greenough Se. 155:
|
23
|
-
#
|
24
|
-
# The following Noun and Adjective forms are also included in the
|
25
|
-
# inflection of the Latin Verb:
|
26
|
-
#
|
27
|
-
# a. Four Participles, viz: --
|
28
|
-
# <em>Active</em>: the Present and Future Participles
|
29
|
-
# <em>Passive</em>: the Perfect Participle and the Gerundive
|
30
|
-
# b. The Gerund: this is in form a neuter noun of the second
|
31
|
-
# declension used only in the oblique cases of hte singular.
|
32
|
-
# c. The Supine: this is in form a verbal noun of the fourth
|
33
|
-
# declension in the accusative (-um) and dative or ablative (-ū)
|
34
|
-
# singular
|
35
|
-
# ...
|
36
|
-
#
|
37
|
-
##
|
38
|
-
module Participles
|
39
|
-
|
40
|
-
##########################################
|
41
|
-
# Participles
|
42
|
-
##########################################
|
43
|
-
|
44
|
-
##
|
45
|
-
#
|
46
|
-
# === GRAMMATICAL FUNCTION
|
47
|
-
#
|
48
|
-
# A&G,158,a. The Present Participle (ending in -ns) has commly the
|
49
|
-
# meaning and use as the English participle in 'ing; as vocāns, calling.
|
50
|
-
# For inflection see egēns, sec. 118
|
51
|
-
#
|
52
|
-
# === ARGUMENTS
|
53
|
-
#
|
54
|
-
# None
|
55
|
-
#
|
56
|
-
# === RETURNS
|
57
|
-
#
|
58
|
-
# Array of participles
|
59
|
-
#
|
60
|
-
###
|
61
|
-
def present_active_participle
|
62
|
-
raise "Participial stem was nil" if participial_stem.nil?
|
63
|
-
endings=%w(ns ntis)
|
64
|
-
return endings.collect{ |x| Linguistics::Latin::Phonographia.fix_macrons(participial_stem+x.chomp)}.join(', ')
|
65
|
-
end
|
66
|
-
|
67
|
-
##
|
68
|
-
#
|
69
|
-
# === GRAMMATICAL FUNCTION
|
70
|
-
#
|
71
|
-
# A&G,158,b. The Future Participle (ending in -ūrus) is oftenest used to
|
72
|
-
# express what is likely or about to happen: as, rēctūrus, about to
|
73
|
-
# rule...
|
74
|
-
#
|
75
|
-
# === ARGUMENTS
|
76
|
-
#
|
77
|
-
# None
|
78
|
-
#
|
79
|
-
# === RETURNS
|
80
|
-
#
|
81
|
-
# Array of participles
|
82
|
-
#
|
83
|
-
###
|
84
|
-
def future_active_participle
|
85
|
-
# In case we have an irregular, or somehow already have a /ūrus$/ we shouldn't do this
|
86
|
-
mybase = (@passive_perfect_participle =~ /ūru.$/) ?
|
87
|
-
@passive_perfect_participle.gsub(/u[sm]$/,'')
|
88
|
-
:
|
89
|
-
@passive_perfect_participle.gsub(/u[sm]$/, "ūr")
|
90
|
-
|
91
|
-
singular_endings=%w(us a um)
|
92
|
-
return singular_endings.collect{|x| mybase+"#{x}".chomp}.join(', ')
|
93
|
-
end
|
94
|
-
|
95
|
-
##
|
96
|
-
#
|
97
|
-
# === GRAMMATICAL FUNCTION
|
98
|
-
#
|
99
|
-
# 158,c. The Perfect Participle (ending in -tus, -sus) has two uses:
|
100
|
-
#
|
101
|
-
# 1. It is sometimes equivalent to the English perfect passive
|
102
|
-
# participle:
|
103
|
-
#
|
104
|
-
# as tеctus, sheltered; acceptus, accepted...; and often simply has an
|
105
|
-
# adjective meaning: as, acceptus, acceptable.
|
106
|
-
#
|
107
|
-
# 2. It is used with the verb to be (esse) to form certain tenses of the
|
108
|
-
# passive: as, vocātus est, he was (has been) called.
|
109
|
-
#
|
110
|
-
# === ARGUMENTS
|
111
|
-
#
|
112
|
-
# None
|
113
|
-
#
|
114
|
-
# === RETURNS
|
115
|
-
#
|
116
|
-
# Array of participles
|
117
|
-
#
|
118
|
-
###
|
119
|
-
def perfect_passive_participle
|
120
|
-
mybase=@passive_perfect_participle.sub(/u[sm]$/,'')
|
121
|
-
singular_endings=%w(us a um)
|
122
|
-
return singular_endings.collect{|x| mybase+"#{x}".chomp}.join(', ')
|
123
|
-
end
|
124
|
-
|
125
|
-
##
|
126
|
-
#
|
127
|
-
# === GRAMMATICAL FUNCTION
|
128
|
-
#
|
129
|
-
# <em>See</em>: Gerundive
|
130
|
-
#
|
131
|
-
# === ARGUMENTS
|
132
|
-
#
|
133
|
-
# None
|
134
|
-
#
|
135
|
-
# === RETURNS
|
136
|
-
#
|
137
|
-
# Array of participles
|
138
|
-
#
|
139
|
-
###
|
140
|
-
def future_passive_participle
|
141
|
-
mybase = participial_stem+"nd"
|
142
|
-
singular_endings=%w(us a um)
|
143
|
-
return singular_endings.collect{|x|Linguistics::Latin::Phonographia.fix_macrons( mybase+"#{x}".chomp)}.join(', ')
|
144
|
-
end
|
145
|
-
|
146
|
-
##
|
147
|
-
#
|
148
|
-
# === GRAMMATICAL FUNCTION
|
149
|
-
#
|
150
|
-
# A&G, 158,d.
|
151
|
-
#
|
152
|
-
# The Gerundive (ending in -ndus) has two uses:
|
153
|
-
#
|
154
|
-
# 1. ...an adjective implying obligation...
|
155
|
-
#
|
156
|
-
# 2. In the oblique cases the Gerundive commonly has the same meaning as
|
157
|
-
# the Gerund ... for examples see sec. 503
|
158
|
-
#
|
159
|
-
# === ARGUMENTS
|
160
|
-
#
|
161
|
-
# None
|
162
|
-
#
|
163
|
-
# === RETURNS
|
164
|
-
#
|
165
|
-
# Array of participles
|
166
|
-
#
|
167
|
-
###
|
168
|
-
def gerundive
|
169
|
-
self.future_passive_participle
|
170
|
-
end
|
171
|
-
|
172
|
-
##
|
173
|
-
#--
|
174
|
-
# The gerund is a verbal noun (loving dancing, running) formed like the
|
175
|
-
# gerundive, except that it only has four forms: the n. singular of the
|
176
|
-
# gen, dative, acc, and abl (the oblique cases). They are identical to
|
177
|
-
# the corresponding cases of the gerundive but ae ative in meaning and
|
178
|
-
# correspond to the english "-ing"
|
179
|
-
#
|
180
|
-
# Gerundive: verbal achective
|
181
|
-
# gerund: verbal noun
|
182
|
-
#
|
183
|
-
# gerund only has oblique
|
184
|
-
# gerundive is passive in meaning, gerund is active:
|
185
|
-
#
|
186
|
-
# A FUNNY THING I ALWAYS FORGET:
|
187
|
-
# studium legeni libros ==> studium librorum legendorum
|
188
|
-
# discimus legendo libros ==> discimus libris legendis
|
189
|
-
#
|
190
|
-
# -- Source, Wheelock
|
191
|
-
#++
|
192
|
-
##
|
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
|
-
end
|
@@ -1,109 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
module Linguistics
|
4
|
-
module Latin
|
5
|
-
##
|
6
|
-
#
|
7
|
-
# The Phonographia module handles the phonography of written Latin: how
|
8
|
-
# the sound of Latin is written. In particular, the sounds that need
|
9
|
-
# special notation are the vowels which may bear a long ("ā") or short
|
10
|
-
# ("a") quantity.
|
11
|
-
#
|
12
|
-
# When forming Latin words from heuristic ( as LatinVerb does ), certain
|
13
|
-
# phonographical structures arise that one does not see in the language as
|
14
|
-
# practiced by humans. For example, given "amāre," the stem is "amā."
|
15
|
-
# When the heuristic postpends "t" to get the present, indicative, third
|
16
|
-
# person singular, the result is "amāt," which, by rules of Latin
|
17
|
-
# phonology, must be made to bear a short sound in the ultimate vowel.
|
18
|
-
# This state is _phonographically_ notes as "amat." This module
|
19
|
-
# implements the appropriate rules for proper phonetic compliance.
|
20
|
-
#
|
21
|
-
##
|
22
|
-
module Phonographia
|
23
|
-
class << self
|
24
|
-
# === DESCRIPTION
|
25
|
-
#
|
26
|
-
# Latin has several rules pertaining to how long sounds must behave
|
27
|
-
# based on their neighboring characters. The rules that +fix_macrons+
|
28
|
-
# tests are the following
|
29
|
-
#
|
30
|
-
# === RULES
|
31
|
-
#
|
32
|
-
# <b>Rule 1: </b>:: m/r/t at end of line shortens preceding vowel
|
33
|
-
# <b>Rule 2: </b>:: macron-bearing vowel before vowel, regardless of
|
34
|
-
# its quantity
|
35
|
-
# <b>Rule 3: </b>:: macron-bearing vowel before /n[td]/ anywhere in the string
|
36
|
-
#
|
37
|
-
# === ARGUMENTS
|
38
|
-
#
|
39
|
-
# +s+ :: a string which needs to be processed for Latin phonographic
|
40
|
-
# compliance
|
41
|
-
#
|
42
|
-
# === RETURNS
|
43
|
-
#
|
44
|
-
# String with consonants properly converted
|
45
|
-
#
|
46
|
-
# === EXAMPLE
|
47
|
-
#
|
48
|
-
# fix_macrons(fabām) #=> fabam ( Rule 1 )
|
49
|
-
# fix_macrons(cāīō) #=> caiō ( Rule 1, Rule 2 )
|
50
|
-
#
|
51
|
-
##
|
52
|
-
def fix_macrons(s)
|
53
|
-
raise if s.nil?
|
54
|
-
return "" if s.empty?
|
55
|
-
macron_table = {"\xc4\x81" => 'a',
|
56
|
-
"\xc4\x93" => 'e',
|
57
|
-
"\xc4\xab" => 'i',
|
58
|
-
"\xc5\x8d" => 'o',
|
59
|
-
"\xc5\xab" => 'u',
|
60
|
-
"\xc4\x80" => 'A',
|
61
|
-
"\xc4\x92" => 'E',
|
62
|
-
"\xc4\xaa" => 'I',
|
63
|
-
"\xc5\x8c" => 'O',
|
64
|
-
"\xc5\xaa" => 'U',
|
65
|
-
"ā" => 'a',
|
66
|
-
"ē" => 'e',
|
67
|
-
"ī" => 'i',
|
68
|
-
"ō" => 'o',
|
69
|
-
"ū" => 'u',
|
70
|
-
"Ā" => 'A',
|
71
|
-
"Ē" => 'E',
|
72
|
-
"Ī" => 'I',
|
73
|
-
"Ō" => 'O',
|
74
|
-
"Ū" => 'U',
|
75
|
-
}
|
76
|
-
|
77
|
-
|
78
|
-
# m/r/t at end of line shortens preceding vowel
|
79
|
-
if s =~ /^(.*)([āēīōūĀĒĪŌŪ])([mrt])$/i
|
80
|
-
s = $1 + macron_table[$2] + $3
|
81
|
-
end
|
82
|
-
|
83
|
-
# macron before vowel
|
84
|
-
if s =~ /(.*)([āēīōūĀĒĪŌŪ])([āēīōūĀĒĪŌŪaeiouAEIOU])(.*)/i
|
85
|
-
s = self.fix_macrons $1 + macron_table[$2] + $3 + $4
|
86
|
-
end
|
87
|
-
|
88
|
-
if s=~ /n[td]/
|
89
|
-
# n[td]
|
90
|
-
mutaturum = s.split(//)
|
91
|
-
mutatum = []
|
92
|
-
mutaturum.each_with_index do |e, i|
|
93
|
-
if ( e == "n" and
|
94
|
-
mutaturum[i+1] =~ /[td]/ and
|
95
|
-
not macron_table[mutaturum[i-1]].nil? )
|
96
|
-
mutatum[i-1]=macron_table[mutaturum[i-1]]
|
97
|
-
end
|
98
|
-
mutatum << e
|
99
|
-
end
|
100
|
-
|
101
|
-
return mutatum.join ''
|
102
|
-
end
|
103
|
-
|
104
|
-
return s
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
#
|
3
|
-
module Linguistics
|
4
|
-
module Latin
|
5
|
-
module Verb
|
6
|
-
class LatinVerb
|
7
|
-
##
|
8
|
-
#
|
9
|
-
# === GRAMMATICAL FUNCTION
|
10
|
-
#
|
11
|
-
# The supine is:
|
12
|
-
#
|
13
|
-
# * 4th declension verbal noun
|
14
|
-
# * Formed on the same stem as the perfect passive participle
|
15
|
-
# * Only two forms in common use: accusative and ablative singular
|
16
|
-
#
|
17
|
-
# Ablative is used with the neuter of certain adjectives to indicate
|
18
|
-
# what respect a particular quality is applicable: <em>mirabile
|
19
|
-
# dictu</em>, <em>facile factu</em>. The accusative is used with
|
20
|
-
# verbs of motion to indicate purpose.
|
21
|
-
#
|
22
|
-
# -- Source <em>Wheelock</em>
|
23
|
-
#
|
24
|
-
# === ARGUMENTS
|
25
|
-
#
|
26
|
-
# None
|
27
|
-
#
|
28
|
-
# === RETURNS
|
29
|
-
#
|
30
|
-
# Hash with keys based on [:accusative] or [:ablative]
|
31
|
-
#
|
32
|
-
###
|
33
|
-
def supine
|
34
|
-
acc = passive_perfect_participle
|
35
|
-
abl = acc.sub( /^(.*)um$/, "\\1" )
|
36
|
-
abl += "ū"
|
37
|
-
{:ablative => abl, :accusative => acc}
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|