latinverb 0.9.3 → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,87 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
module Linguistics
|
3
|
-
module Latin
|
4
|
-
module Verb
|
5
|
-
class LatinVerb
|
6
|
-
##
|
7
|
-
#
|
8
|
-
# Required method for JSON deserialization
|
9
|
-
#
|
10
|
-
##
|
11
|
-
def self.json_create(o)
|
12
|
-
new( o )
|
13
|
-
end
|
14
|
-
|
15
|
-
##
|
16
|
-
#
|
17
|
-
# Presents the LatinVerb expressed as a hash with the names of the TenseBlock
|
18
|
-
# specifiers as keys, and corresponding TenseBlock objects, converted to
|
19
|
-
# Arrays, as the values. It also contains the +original_string+.
|
20
|
-
#
|
21
|
-
##
|
22
|
-
def to_hash
|
23
|
-
data_structure = {}
|
24
|
-
@tense_list.each do |t|
|
25
|
-
ts = t.to_sym
|
26
|
-
data_structure[ts]=self.send ts
|
27
|
-
end
|
28
|
-
data_structure['original_string'] = @original_string
|
29
|
-
return data_structure
|
30
|
-
end
|
31
|
-
|
32
|
-
alias_method :to_h, :to_hash
|
33
|
-
|
34
|
-
##
|
35
|
-
#
|
36
|
-
# Takes the hash that results from to_hash and then converts it to
|
37
|
-
# YAML.
|
38
|
-
#
|
39
|
-
##
|
40
|
-
def to_yaml
|
41
|
-
to_hash.to_yaml
|
42
|
-
end
|
43
|
-
|
44
|
-
alias_method :to_y, :to_yaml
|
45
|
-
|
46
|
-
##
|
47
|
-
#
|
48
|
-
# Required method for JSON deserialization
|
49
|
-
#
|
50
|
-
##
|
51
|
-
def to_json(*a)
|
52
|
-
json_hash = {'json_class' => self.class.name}
|
53
|
-
|
54
|
-
# In the case that we're working with a regular verb, the only thing
|
55
|
-
# we need to save is the original string, since everything can be
|
56
|
-
# re-derived from it easily.
|
57
|
-
unless self.irregular?
|
58
|
-
# While this single string is sufficient to freeze and revivifty
|
59
|
-
# the verb, it means that the JSON structure is rather vacuous.
|
60
|
-
# Given this, the hash is enriched so that the JSON data is
|
61
|
-
# useful. Nevertheless, in the revivification process, only
|
62
|
-
# 'orig_string' is used.
|
63
|
-
%w{original_string classification stem}.each do |k|
|
64
|
-
json_hash[k] = self.send k.to_sym
|
65
|
-
end
|
66
|
-
json_hash['tense_list' ] = {}
|
67
|
-
@tense_list.each do |t|
|
68
|
-
json_hash['tense_list'][t.to_s] = self.send t.to_sym
|
69
|
-
end
|
70
|
-
json_hash['irregular'] = irregular?
|
71
|
-
return json_hash.to_json(*a)
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
##
|
76
|
-
#
|
77
|
-
# Dumps the LatinVerb as pretty JSON
|
78
|
-
#
|
79
|
-
##
|
80
|
-
def pretty_generate
|
81
|
-
JSON.pretty_generate( self.to_h )
|
82
|
-
end
|
83
|
-
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module Linguistics
|
2
|
-
module Latin
|
3
|
-
module Verb
|
4
|
-
class LatinVerb
|
5
|
-
module DefectiveChecker
|
6
|
-
def self.is_it_defective?(instance)
|
7
|
-
first_person_present_tense = instance.first_person_singular
|
8
|
-
present_active_infinitive = instance.present_active_infinitive
|
9
|
-
found = Linguistics::Latin::Verb::LatinVerb::PRESENT_ONLY.member?( first_person_present_tense ) ||
|
10
|
-
Linguistics::Latin::Verb::LatinVerb::PRESENT_ONLY.member?( present_active_infinitive )
|
11
|
-
return Linguistics::Latin::Verb::Classification::PresentOnly if found
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,159 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
module Linguistics
|
4
|
-
module Latin
|
5
|
-
module Verb
|
6
|
-
class LatinVerb
|
7
|
-
module Deponent
|
8
|
-
# In a bit of cleverness, if the verb is deponent, we have built out
|
9
|
-
# this verb as if it were regular, but we have also created a
|
10
|
-
# @proxyVerb which is the active 'pseudo verb' corresponding to this
|
11
|
-
# verb. We should be able to take this verb's active formulations
|
12
|
-
# and set their results to the @proxyVerb's passive formulations
|
13
|
-
#
|
14
|
-
# Ergo: miror/mirari/miratus =~
|
15
|
-
# miro/mirare/PreventDeponentInfiniteRegress/miratus Therefore make a
|
16
|
-
# LatinVerb.new(miro/mirare/PreventDeponentInfiniteRegress/miratus).
|
17
|
-
# Take its passives and set them to this verb's actives. This is
|
18
|
-
# actually what students do heuristically in Latin classes.
|
19
|
-
|
20
|
-
def self.included(including_class)
|
21
|
-
debugger
|
22
|
-
puts 'hi'
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.extended(extending_instance)
|
26
|
-
extending_instance.instance_eval do
|
27
|
-
@proxy_verb_string = Linguistics::Latin::Verb::LatinVerb.create_pseudo_active_mask_for_deponent @original_string
|
28
|
-
@proxyVerb = Linguistics::Latin::Verb::LatinVerb.new @proxy_verb_string
|
29
|
-
apply_deponent_masking
|
30
|
-
end
|
31
|
-
end
|
32
|
-
##
|
33
|
-
#
|
34
|
-
# Top-level method used to call the sub-methods which create a facade so that
|
35
|
-
# active_ vectors can be called on a deponent which actually forwards that
|
36
|
-
# call to a "fake" non-deponent (+@proxyVerb+) whose passives fit the correct
|
37
|
-
# morphology
|
38
|
-
#
|
39
|
-
# It calls the following methods, each of which applies the masking to a
|
40
|
-
# certain collection of vectors:
|
41
|
-
#
|
42
|
-
# * +deponent_swap+ :: active_voice* remaps "standard" calls like
|
43
|
-
# +active_voice_indicative_mood_present_tense...+
|
44
|
-
# * +deponent_imperative_mutations+ :: masks the imperatives
|
45
|
-
# * +deponent_participle_mutations+ :: masks the participles
|
46
|
-
# * +deponent_infinitive_mutations+ :: masks the infinitives
|
47
|
-
#
|
48
|
-
##
|
49
|
-
|
50
|
-
def apply_deponent_masking
|
51
|
-
deponent_swap
|
52
|
-
deponent_imperative_mutations
|
53
|
-
deponent_participle_mutations
|
54
|
-
deponent_infinitive_mutations
|
55
|
-
end
|
56
|
-
|
57
|
-
##
|
58
|
-
#
|
59
|
-
# The deponent's imperatives require a bit of consideration. They don't
|
60
|
-
# follow the stem/stem+'ite' format.
|
61
|
-
#
|
62
|
-
##
|
63
|
-
|
64
|
-
def deponent_imperative_mutations # :nodoc:
|
65
|
-
self.singleton_class.class_eval do
|
66
|
-
def active_voice_imperative_mood_present_tense_second_person_singular_number
|
67
|
-
return @proxyVerb.instance_variable_get '@present_active_infinitive'
|
68
|
-
end
|
69
|
-
def active_voice_imperative_mood_present_tense_second_person_plural_number
|
70
|
-
return @proxyVerb.send :passive_voice_indicative_mood_present_tense_second_person_plural_number
|
71
|
-
end
|
72
|
-
def active_voice_imperative_mood_future_tense_second_person_singular_number
|
73
|
-
k=@proxyVerb.send :passive_voice_indicative_mood_present_tense_second_person_plural_number
|
74
|
-
k.sub!(/minī$/, '')
|
75
|
-
k += 'tor'
|
76
|
-
Linguistics::Latin::Phonographia.fix_macrons k
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
def deponent_participle_mutations # :nodoc:
|
82
|
-
self.singleton_class.class_eval do
|
83
|
-
def present_active_participle
|
84
|
-
return @proxyVerb.present_active_participle
|
85
|
-
end
|
86
|
-
|
87
|
-
def future_active_participle
|
88
|
-
return @proxyVerb.future_active_participle
|
89
|
-
end
|
90
|
-
|
91
|
-
def perfect_active_participle
|
92
|
-
return @proxyVerb.perfect_passive_participle
|
93
|
-
end
|
94
|
-
|
95
|
-
def future_passive_participle
|
96
|
-
return @proxyVerb.future_passive_participle
|
97
|
-
end
|
98
|
-
|
99
|
-
# Mask the supine
|
100
|
-
def supine
|
101
|
-
return @proxyVerb.supine
|
102
|
-
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
def deponent_infinitive_mutations # :nodoc:
|
107
|
-
self.singleton_class.class_eval do
|
108
|
-
def present_active_infinitive
|
109
|
-
return @proxyVerb.send :present_passive_infinitive
|
110
|
-
end
|
111
|
-
def perfect_active_infinitive
|
112
|
-
return @proxyVerb.send :perfect_passive_infinitive
|
113
|
-
end
|
114
|
-
def future_active_infinitive
|
115
|
-
return @proxyVerb.send :future_active_infinitive
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
##
|
121
|
-
#
|
122
|
-
# Swaps this verb's active_ vectors and replaces them with
|
123
|
-
# @proxyVerb's passive_ vectors. This is pretty darned sneaky. See
|
124
|
-
# Also deponent_swap
|
125
|
-
#
|
126
|
-
##
|
127
|
-
|
128
|
-
def deponent_swap
|
129
|
-
# First, get the methods that were defined in the proxy as passive
|
130
|
-
|
131
|
-
storage = {}
|
132
|
-
|
133
|
-
@tense_list.grep(/^passive/).each do |pass|
|
134
|
-
# Find the active correlate
|
135
|
-
active_corr = pass.to_s.sub( /^passive(.*)/, "active\\1" )
|
136
|
-
|
137
|
-
# Keep @proxyVerb in the binding scope
|
138
|
-
pV = @proxyVerb
|
139
|
-
|
140
|
-
# In self, find the passive and save it's resultant object into a
|
141
|
-
# hash for future use.
|
142
|
-
self.singleton_class.class_eval do
|
143
|
-
storage[active_corr.to_sym] = pV.send(pass)
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
# Take the stored hashes and define instance methods on self such
|
148
|
-
# that we intercept the mixed-in methods ( C-c-c-combo breaker! ).
|
149
|
-
storage.each_pair do |k,v|
|
150
|
-
self.singleton_class.class_eval do
|
151
|
-
define_method k, lambda { return v }
|
152
|
-
end
|
153
|
-
end
|
154
|
-
end
|
155
|
-
end
|
156
|
-
end
|
157
|
-
end
|
158
|
-
end
|
159
|
-
end
|
@@ -1,22 +0,0 @@
|
|
1
|
-
module Linguistics
|
2
|
-
module Latin
|
3
|
-
module Verb
|
4
|
-
class LatinVerb
|
5
|
-
|
6
|
-
##
|
7
|
-
#
|
8
|
-
# <b>You should not be using this, probably</b>
|
9
|
-
#
|
10
|
-
# This is a a convenience method so that you can print out the
|
11
|
-
# contents in a human-readable fashion. LatinVerb is a library that
|
12
|
-
# _should be implemented elsewhere_ where its results can be presented
|
13
|
-
# by more view-oriented libraries or applications.
|
14
|
-
##
|
15
|
-
def display
|
16
|
-
STDERR.puts "You should not be doing much displaying here as this is a LIBRARY. Implement this elsewhere."
|
17
|
-
pretty_generate
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
module Linguistics
|
2
|
-
module Latin
|
3
|
-
module Verb
|
4
|
-
class LatinVerb
|
5
|
-
##
|
6
|
-
#
|
7
|
-
# Some verbs only take a active/indic/pres/3rd/sg ("it rains"). For
|
8
|
-
# these we will not add the full vectors of methods, but will only
|
9
|
-
# respond to THAT vector.
|
10
|
-
#
|
11
|
-
##
|
12
|
-
module Impersonal
|
13
|
-
def self.extended(extending_instance)
|
14
|
-
extending_instance.instance_eval do
|
15
|
-
prepare_present_only
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def prepare_present_only
|
20
|
-
singleton_class.class_eval do
|
21
|
-
def active_voice_indicative_mood_present_tense
|
22
|
-
TenseBlock.new ["", "", @original_string,
|
23
|
-
"", "", ""]
|
24
|
-
end
|
25
|
-
def active_voice_indicative_mood_present_tense_third_person_singular_number
|
26
|
-
return active_voice_indicative_mood_present_tense[2]
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,83 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
module Linguistics
|
3
|
-
module Latin
|
4
|
-
module Verb
|
5
|
-
class LatinVerb
|
6
|
-
module Irregular
|
7
|
-
def self.extended(extending_instance)
|
8
|
-
extending_instance.instance_eval do
|
9
|
-
begin
|
10
|
-
os_sym = symbolize_original_string
|
11
|
-
json_string = Linguistics::Latin::Verb.const_get os_sym
|
12
|
-
|
13
|
-
raise "Found a JSON string with an absurdly small length!" if json_string.length <= 10
|
14
|
-
revivified_data_structure = JSON.parse( json_string )
|
15
|
-
rescue JSON::ParserError => e
|
16
|
-
puts "We were unable to parse JSON for #{@original_string} [o:#{o}] [o_sym:#{o_upcase_and_symbolic}]. Please verify your syntax."
|
17
|
-
raise e
|
18
|
-
rescue NameError => e
|
19
|
-
puts "We were unable to find a definition for #{@original_string}"
|
20
|
-
raise e
|
21
|
-
rescue => error
|
22
|
-
warn "#{@original_string} was identified as irregular but did not have a definition provided."
|
23
|
-
raise error
|
24
|
-
end
|
25
|
-
|
26
|
-
revivified_data_structure['tense_blocks'].each_pair do |k,v|
|
27
|
-
singleton_class.class_eval do
|
28
|
-
define_method k.to_sym do
|
29
|
-
TenseBlock.new v, { :meaning => MEANINGS[k.to_sym] }
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
@irregular_infinitives = revivified_data_structure['infinitives']
|
35
|
-
@irregular_participles = revivified_data_structure['participles']
|
36
|
-
|
37
|
-
return if @irregular_infinitives.nil?
|
38
|
-
return if @irregular_participles.nil?
|
39
|
-
|
40
|
-
self.instance_eval do
|
41
|
-
def present_active_infinitive; return @irregular_infinitives.present_active_infinitive; end
|
42
|
-
def present_passive_infinitive; return @irregular_infinitives.present_passive_infinitive; end
|
43
|
-
def perfect_active_infinitive; return @irregular_infinitives.perfect_active_infinitive; end
|
44
|
-
def perfect_passive_infinitive; return @irregular_infinitives.perfect_passive_infinitive; end
|
45
|
-
def future_passive_infinitive; return @irregular_infinitives.future_passive_infinitive; end
|
46
|
-
def future_active_infinitive; return @irregular_infinitives.future_active_infinitive; end
|
47
|
-
end
|
48
|
-
|
49
|
-
self.instance_eval do
|
50
|
-
def present_active_participle; return @irregular_participles.present_active_participle; end
|
51
|
-
def future_active_participle; return @irregular_participles.future_active_participle; end
|
52
|
-
def perfect_passive_participle; return @irregular_participles.perfect_passive_participle; end
|
53
|
-
def future_passive_participle; return @irregular_participles.future_passive_participle; end
|
54
|
-
def gerundive; return @irregular_participles.gerundive; end
|
55
|
-
def gerund; return @irregular_participles.d; end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def symbolize_original_string
|
61
|
-
# Translation added to account for Ruby not liking constants /^/
|
62
|
-
# with a multibyte. Probably a bug.
|
63
|
-
#
|
64
|
-
# This bug can be discovered by running #constants on
|
65
|
-
# Linguistics::Latin::Verb and seeing that Ōxxx is not found. To
|
66
|
-
# fix this i had to store it as ODI_. To make /that/ hack work, I
|
67
|
-
# had to add this bit beginning two lines below :-/
|
68
|
-
o = ActiveSupport::Multibyte::Chars.new( @original_string.gsub(/\s+/,'_') ).upcase
|
69
|
-
|
70
|
-
if o.match(/^([ĀĒĪŌŪ])(.*)/)
|
71
|
-
x=o[0,1].tr 'ĀĒĪŌŪ', 'AEIOU'
|
72
|
-
y=o[1,o.length]
|
73
|
-
o= x+y
|
74
|
-
end
|
75
|
-
|
76
|
-
o.to_sym
|
77
|
-
end
|
78
|
-
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
module Linguistics
|
3
|
-
module Latin
|
4
|
-
module Verb
|
5
|
-
class LatinVerb
|
6
|
-
class LatinVerbTypeEvaluator
|
7
|
-
def initialize(first_pres, infinitive, classifier)
|
8
|
-
return unless classifier.classification.to_s.split('::').last.eql?("Regular")
|
9
|
-
@type = if infinitive =~ /āre$/
|
10
|
-
Linguistics::Latin::Verb::VerbTypes::First
|
11
|
-
elsif infinitive =~ /ēre$/
|
12
|
-
Linguistics::Latin::Verb::VerbTypes::Second
|
13
|
-
elsif infinitive =~ /ere$/
|
14
|
-
first_pres =~ /i.$/ ? Linguistics::Latin::Verb::VerbTypes::ThirdIO : Linguistics::Latin::Verb::VerbTypes::Third
|
15
|
-
elsif infinitive =~ /.+īre$/
|
16
|
-
Linguistics::Latin::Verb::VerbTypes::Fourth
|
17
|
-
elsif (infinitive =~ /ī$/ and first_pres =~ /r$/)
|
18
|
-
Linguistics::Latin::Verb::VerbTypes::Deponent
|
19
|
-
else
|
20
|
-
raise "Could not find a verb type for this verb #{infinitive} and #{first_pres}"
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def inspect
|
25
|
-
return @type
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
@@ -1,100 +0,0 @@
|
|
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
|
@@ -1,32 +0,0 @@
|
|
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
|
@@ -1,106 +0,0 @@
|
|
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
|