linguistics_latin 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +33 -0
- data/Rakefile +1 -0
- data/lib/linguistics_latin/phonographia.rb +114 -0
- data/lib/linguistics_latin/verb/classification_type/defective.rb +10 -0
- data/lib/linguistics_latin/verb/classification_type/deponent.rb +10 -0
- data/lib/linguistics_latin/verb/classification_type/impersonal.rb +10 -0
- data/lib/linguistics_latin/verb/classification_type/irregular.rb +10 -0
- data/lib/linguistics_latin/verb/classification_type/present_only.rb +10 -0
- data/lib/linguistics_latin/verb/classification_type/regular.rb +10 -0
- data/lib/linguistics_latin/verb/classification_type/semideponent.rb +10 -0
- data/lib/linguistics_latin/verb/classification_types.rb +25 -0
- data/lib/linguistics_latin/verb/constants.rb +198 -0
- data/lib/linguistics_latin/verb/irregulars.rb +3900 -0
- data/lib/linguistics_latin/verb/verb_types/first.rb +10 -0
- data/lib/linguistics_latin/verb/verb_types/fourth.rb +10 -0
- data/lib/linguistics_latin/verb/verb_types/irregular.rb +10 -0
- data/lib/linguistics_latin/verb/verb_types/second.rb +10 -0
- data/lib/linguistics_latin/verb/verb_types/third.rb +10 -0
- data/lib/linguistics_latin/verb/verb_types/third_io.rb +10 -0
- data/lib/linguistics_latin/verb/verb_types.rb +24 -0
- data/lib/linguistics_latin/verb.rb +4 -0
- data/lib/linguistics_latin/version.rb +5 -0
- data/lib/linguistics_latin.rb +10 -0
- data/linguistics_latin.gemspec +23 -0
- metadata +100 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e13e86e29ef889a439466f81efdd0c7df98c6584
|
4
|
+
data.tar.gz: fba0b23996a56a673a6cffddfbf7a4f9e4c8b171
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b4dd43c73e2e1af98e137f7f1cd4a3f479be9f3250191a00cc4fc209d70748489d6aafcfc1d70a4a65282ed78882189d2badb77118971039fb1df93864b84866
|
7
|
+
data.tar.gz: dec9ff0d554fa1c1e5884e212135d6f06f4d56ff66f5176cc7634ce57899c9e783ede7f89523b181ff0e750edc3b10824572ed18ba624f742dfdf1b0e1f671e7
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Steven G. Harms
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# Linguistics::Latin
|
2
|
+
|
3
|
+
A module which models the Latin language's verbs an phonographic
|
4
|
+
behavior. These are behaviors and inhabitants of Latin grammar
|
5
|
+
universe. Regardless of which programs use these data, these behaviors
|
6
|
+
will always remain true.
|
7
|
+
|
8
|
+
By way of constrast, another library (say, [LatinVerb][]) might *use*
|
9
|
+
these definitions, but does not alter them. Particular data structures
|
10
|
+
for processing or mutating data are native to client libraries.
|
11
|
+
|
12
|
+
I should hope that in future this gem and others like it be merged into
|
13
|
+
a common Linguistics Gem.
|
14
|
+
|
15
|
+
[LatinVerb]: https://github.com/sgharms/LatinVerb
|
16
|
+
|
17
|
+
## Installation
|
18
|
+
|
19
|
+
Add this line to your application's Gemfile:
|
20
|
+
|
21
|
+
gem 'linguistics_latin'
|
22
|
+
|
23
|
+
And then execute:
|
24
|
+
|
25
|
+
$ bundle
|
26
|
+
|
27
|
+
Or install it yourself as:
|
28
|
+
|
29
|
+
$ gem install linguistics_latin
|
30
|
+
|
31
|
+
## Usage
|
32
|
+
|
33
|
+
This is pretty much a library which defines some constants.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,114 @@
|
|
1
|
+
module Linguistics
|
2
|
+
module Latin
|
3
|
+
##
|
4
|
+
#
|
5
|
+
# The Phonographia module handles the phonography of written Latin: how
|
6
|
+
# the sound of Latin is written. In particular, the sounds that need
|
7
|
+
# special notation are the vowels which may bear a long ("ā") or short
|
8
|
+
# ("a") quantity.
|
9
|
+
#
|
10
|
+
# When forming Latin words from heuristic (as LatinVerb does), certain
|
11
|
+
# phonographical structures arise that one does not see in the language as
|
12
|
+
# practiced by humans. For example, given "amāre," the stem is "amā."
|
13
|
+
# When the heuristic postpends "t" to get the present, indicative, third
|
14
|
+
# person singular, the result is "amāt," which, by rules of Latin
|
15
|
+
# phonology, must be made to bear a short sound in the ultimate vowel.
|
16
|
+
# This state is _phonographically_ notes as "amat." This module
|
17
|
+
# implements the appropriate rules for proper phonetic compliance.
|
18
|
+
#
|
19
|
+
# === DESCRIPTION
|
20
|
+
#
|
21
|
+
# Latin has several rules pertaining to how long sounds must behave
|
22
|
+
# based on their neighboring characters. The rules that +fix_macrons+
|
23
|
+
# tests are the following
|
24
|
+
#
|
25
|
+
# === RULES
|
26
|
+
#
|
27
|
+
# <b>Rule 1: </b>:: m/r/t at end of line shortens preceding vowel
|
28
|
+
# <b>Rule 2: </b>:: macron-bearing vowel before vowel, regardless of
|
29
|
+
# its quantity
|
30
|
+
# <b>Rule 3: </b>:: macron-bearing vowel before /n[td]/ anywhere in the string
|
31
|
+
#
|
32
|
+
# === ARGUMENTS
|
33
|
+
#
|
34
|
+
# +s+ :: a string which needs to be processed for Latin phonographic
|
35
|
+
# compliance
|
36
|
+
#
|
37
|
+
# === RETURNS
|
38
|
+
#
|
39
|
+
# String with consonants properly converted
|
40
|
+
#
|
41
|
+
# === EXAMPLE
|
42
|
+
#
|
43
|
+
# fix_macrons(fabām) #=> fabam ( Rule 1 )
|
44
|
+
# fix_macrons(cāīō) #=> caiō ( Rule 1, Rule 2 )
|
45
|
+
#
|
46
|
+
##
|
47
|
+
module Phonographia
|
48
|
+
MACRON_TABLE = {
|
49
|
+
"\xc4\x81" => 'a',
|
50
|
+
"\xc4\x93" => 'e',
|
51
|
+
"\xc4\xab" => 'i',
|
52
|
+
"\xc5\x8d" => 'o',
|
53
|
+
"\xc5\xab" => 'u',
|
54
|
+
"\xc4\x80" => 'A',
|
55
|
+
"\xc4\x92" => 'E',
|
56
|
+
"\xc4\xaa" => 'I',
|
57
|
+
"\xc5\x8c" => 'O',
|
58
|
+
"\xc5\xaa" => 'U',
|
59
|
+
"ā" => 'a',
|
60
|
+
"ē" => 'e',
|
61
|
+
"ī" => 'i',
|
62
|
+
"ō" => 'o',
|
63
|
+
"ū" => 'u',
|
64
|
+
"Ā" => 'A',
|
65
|
+
"Ē" => 'E',
|
66
|
+
"Ī" => 'I',
|
67
|
+
"Ō" => 'O',
|
68
|
+
"Ū" => 'U'
|
69
|
+
}
|
70
|
+
|
71
|
+
class << self
|
72
|
+
def fix_macrons(s)
|
73
|
+
s = mrt_at_end_of_word(s)
|
74
|
+
s = macron_before_vowel(s)
|
75
|
+
s = macron_before_nd(s)
|
76
|
+
s
|
77
|
+
end
|
78
|
+
|
79
|
+
def mrt_at_end_of_word(s)
|
80
|
+
if s =~ /^(.*)([āēīōūĀĒĪŌŪ])([mrt])$/i
|
81
|
+
return $1 + MACRON_TABLE[$2] + $3
|
82
|
+
end
|
83
|
+
s
|
84
|
+
end
|
85
|
+
|
86
|
+
def macron_before_vowel(s)
|
87
|
+
if s =~ /(.*)([āēīōūĀĒĪŌŪ])([āēīōūĀĒĪŌŪaeiouAEIOU])(.*)/i
|
88
|
+
return self.fix_macrons $1 + MACRON_TABLE[$2] + $3 + $4
|
89
|
+
end
|
90
|
+
s
|
91
|
+
end
|
92
|
+
|
93
|
+
def macron_before_nd(s)
|
94
|
+
if s =~ /n[td]/
|
95
|
+
mutaturum = s.split(//)
|
96
|
+
mutatum = []
|
97
|
+
mutaturum.each_with_index do |e, i|
|
98
|
+
if ( e == "n" && mutaturum[i+1].match(/[td]/) && !MACRON_TABLE[mutaturum[i-1]].nil? )
|
99
|
+
mutatum[i-1] = MACRON_TABLE[mutaturum[i-1]]
|
100
|
+
end
|
101
|
+
mutatum << e
|
102
|
+
end
|
103
|
+
return mutatum.join ''
|
104
|
+
end
|
105
|
+
s
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def fix_macrons(s)
|
110
|
+
Linguistics::Latin::Phonographia.fix_macrons(s)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Linguistics
|
2
|
+
module Latin
|
3
|
+
module Verb
|
4
|
+
module Classification
|
5
|
+
class ClassificationType
|
6
|
+
def self.short_name
|
7
|
+
self.to_s.split('::').last
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.short_name_key
|
11
|
+
short_name.to_sym
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
require_relative './classification_type/defective'
|
20
|
+
require_relative './classification_type/deponent'
|
21
|
+
require_relative './classification_type/impersonal'
|
22
|
+
require_relative './classification_type/irregular'
|
23
|
+
require_relative './classification_type/present_only'
|
24
|
+
require_relative './classification_type/regular'
|
25
|
+
require_relative './classification_type/semideponent'
|
@@ -0,0 +1,198 @@
|
|
1
|
+
module Linguistics
|
2
|
+
module Latin
|
3
|
+
module Verb
|
4
|
+
# :stopdoc:
|
5
|
+
# active_present_endings: ("ap_"-prefixed)
|
6
|
+
AP_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS = %w(s t mus tis nt)
|
7
|
+
AP_THIRD_CONJUG_PERS_ENDINGS = %w(ō is it imus itis unt)
|
8
|
+
AP_THIRDIO_CONJG_PERS_ENDINGS = %w(is it imus itis iunt)
|
9
|
+
|
10
|
+
# active_imperfect_endings: ("ai_"-prefixed)
|
11
|
+
AI_FIRST_AND_SECOND_CONJUG_PERS_ENDINGS = %w(bam bās bat bāmus bātis bant)
|
12
|
+
AI_THIRD_CONJUG_PERS_ENDINGS = %w(ēbam ēbās ēbat ēbāmus ēbātis ēbant)
|
13
|
+
|
14
|
+
# active_future_endings: ("af_"-prefixed)
|
15
|
+
AF_ONE_TWO_ENDINGS = %w(bō bis bit bimus bitis bunt)
|
16
|
+
AF_OTHER_ENDINGS = %w(am ēs et ēmus ētis ent)
|
17
|
+
|
18
|
+
# active_perfect_present: ("aperf"-prefixed)
|
19
|
+
APERF_ENDINGS = %w(istī it imus istis ērunt)
|
20
|
+
APERF_PAST_ENDINGS = PLUPERF_ENDINGS =
|
21
|
+
%w(eram erās erat erāmus erātis erant)
|
22
|
+
APERF_FUTURE_ENDINGS = %w(erō eris erit erimus eritis erint)
|
23
|
+
|
24
|
+
# passive endings
|
25
|
+
PASSIVE_ENDINGS_FIRST_AND_SECOND_CONJG =
|
26
|
+
%w(r ris tur mur minī ntur)
|
27
|
+
PASSIVE_ENDINGS_OTHER =
|
28
|
+
%w(r eris itur imur iminī untur)
|
29
|
+
|
30
|
+
PASS_PERF_PRESENT_ENDINGS = %w(sum es est sumus estis sunt)
|
31
|
+
PASS_PERF_PAST_ENDINGS = %w(eram erās erat erāmus erātis erant)
|
32
|
+
PASS_PERF_FUTURE_ENDINGS = %w(erō eris erit erimus eritis erint)
|
33
|
+
|
34
|
+
PASS_PERF_SUBJUNCTIVE_ENDINGS = %w(sim sis sit simus sitis sint)
|
35
|
+
PASS_PLUPERF_PAST_ENDINGS = %w(essem essēs esset essēmus essētis essent)
|
36
|
+
|
37
|
+
# subjunctive tools
|
38
|
+
# hash for getting a verb's subjunctive stem
|
39
|
+
# based off the W[e] F[ea]r [A] L[ia]r mnemonic
|
40
|
+
ACTIVE_PRESENT_SUBJUNCTIVE_ENDINGS = {
|
41
|
+
:First => "ē" ,
|
42
|
+
:Second => "eā",
|
43
|
+
:Third => "ā" ,
|
44
|
+
:Fourth => "iā",
|
45
|
+
:ThirdIO => "iā"
|
46
|
+
}
|
47
|
+
|
48
|
+
# Listing of all defective verbs
|
49
|
+
# See A&G Sec. 205
|
50
|
+
DEFECTIVE_VERBS = %w{
|
51
|
+
addormisco
|
52
|
+
adolesco
|
53
|
+
aio
|
54
|
+
albesco
|
55
|
+
arboresco
|
56
|
+
aresco
|
57
|
+
assenesco
|
58
|
+
auresco
|
59
|
+
candesco
|
60
|
+
canesco
|
61
|
+
celebresco
|
62
|
+
cornesco
|
63
|
+
crudesco
|
64
|
+
dulcesco
|
65
|
+
effor
|
66
|
+
erubesco
|
67
|
+
extollo
|
68
|
+
grandesco
|
69
|
+
inquam
|
70
|
+
languesco
|
71
|
+
latesco
|
72
|
+
longisco
|
73
|
+
lucesco
|
74
|
+
marcesco
|
75
|
+
matresco
|
76
|
+
mollesco
|
77
|
+
remollesco
|
78
|
+
siccesco
|
79
|
+
sterto
|
80
|
+
tenebresco
|
81
|
+
tremesco
|
82
|
+
tumesco
|
83
|
+
veteresco
|
84
|
+
}
|
85
|
+
|
86
|
+
# Listing of all impersonal verbs
|
87
|
+
# See A&G #207
|
88
|
+
IMPERSONAL_VERBS = %w{
|
89
|
+
accidit
|
90
|
+
addecet
|
91
|
+
advesperascit
|
92
|
+
certum est
|
93
|
+
condecet
|
94
|
+
constat
|
95
|
+
contingit
|
96
|
+
cōnstat
|
97
|
+
decet
|
98
|
+
dedecet
|
99
|
+
dēlecat
|
100
|
+
evenit
|
101
|
+
fit
|
102
|
+
fulgerat
|
103
|
+
grandinat
|
104
|
+
ifvat
|
105
|
+
interest
|
106
|
+
licet
|
107
|
+
lūcīscit hōc
|
108
|
+
miseret
|
109
|
+
necesse est
|
110
|
+
ningit
|
111
|
+
obtingit
|
112
|
+
obvenit
|
113
|
+
oportet
|
114
|
+
paenitet
|
115
|
+
piget
|
116
|
+
placet
|
117
|
+
pluit
|
118
|
+
pluo
|
119
|
+
praestat
|
120
|
+
pudet
|
121
|
+
restat
|
122
|
+
rēfert
|
123
|
+
rōrat
|
124
|
+
superest
|
125
|
+
taedet
|
126
|
+
tonat
|
127
|
+
vacat
|
128
|
+
vesperāscit
|
129
|
+
vidētur
|
130
|
+
ēvenit
|
131
|
+
}
|
132
|
+
|
133
|
+
# Present system only. See A&G206
|
134
|
+
# There are probably more of these, but A&G only lists these two.
|
135
|
+
PRESENT_ONLY = %w{
|
136
|
+
maēre
|
137
|
+
ferīre
|
138
|
+
aiō
|
139
|
+
inquam
|
140
|
+
for
|
141
|
+
quaesō
|
142
|
+
ovāre
|
143
|
+
}
|
144
|
+
|
145
|
+
# See A&G # 192
|
146
|
+
SEMI_DEPONENTS = {
|
147
|
+
'audeō' => %w(audēre ausus),
|
148
|
+
'fidō' => %w(fidere fīsus),
|
149
|
+
'gaudeō' => %w(gaudēre gāvīsus),
|
150
|
+
'soleō' => %w(solēre solitus),
|
151
|
+
}
|
152
|
+
|
153
|
+
# Irregular Verbs. See A&G 197
|
154
|
+
IRREGULAR_VERBS = {
|
155
|
+
'sum' => 'SUM_ESSE_FUĪ_FUTŪRUS',
|
156
|
+
'possum' => 'POSSUM_POSSE_POTUĪ',
|
157
|
+
'ferō' => 'FERŌ_FERRE_TULĪ_LĀTUM',
|
158
|
+
'eō' => 'EŌ_ĪRE_IVĪ_ITUM',
|
159
|
+
'nōlō' => 'NŌLŌ_NŌLLE_NŌLUĪ',
|
160
|
+
'volō' => 'VOLŌ_VELLE_VOLUĪ',
|
161
|
+
'mālō' => 'MĀLŌ_MĀLLE_MĀLUĪ',
|
162
|
+
'dō' => 'DŌ_DĀRE_DEDĪ_DATUM',
|
163
|
+
'edō' => 'EDŌ_ĒSSE_ĒDĪ_ĒSUM',
|
164
|
+
'queō' => 'QUEŌ_QUĪRE_QUĪVĪ',
|
165
|
+
'fiō' => 'FIŌ_FIĒRĪ_FACTUS',
|
166
|
+
'prōsum' => 'PRŌSUM_PRŌDESSE_PRŌFUĪ_PRŌFUTŪRUS',
|
167
|
+
'meminī' => 'MEMINĪ_MEMINISSE',
|
168
|
+
'ōdī' => 'ODĪ_ŌDISSE',
|
169
|
+
'coepī' => 'COEPĪ_COEPISSE_COEPTUM'
|
170
|
+
}
|
171
|
+
|
172
|
+
MEANINGS = {
|
173
|
+
:active_voice_imperative_mood_future_tense => "Command that something be done in the future",
|
174
|
+
:active_voice_indicative_mood_future_tense=> "Action to take place in the future: 'I will eat a hamburger.'" ,
|
175
|
+
:active_voice_indicative_mood_futureperfect_tense => "Action to be completed in the future: 'I will have eaten a hamburger.'" ,
|
176
|
+
:active_voice_indicative_mood_imperfect_tense => "Sustained, habitual action in the past: 'I was eating hamburgers daily when I was a freshman.'" ,
|
177
|
+
:active_voice_indicative_mood_pastperfect_tense => "Action completed prior to a point in the past under discussion: 'I had eaten all the hamburgers (before my mother found out).'" ,
|
178
|
+
:active_voice_indicative_mood_perfect_tense => "Action completed in the past: 'I ate a hamburger.'" ,
|
179
|
+
:active_voice_indicative_mood_present_tense => "Present, possibly ongoing action relative to the speaker: 'I am eating a hamburger. I eat a hamburger.'" ,
|
180
|
+
:active_voice_subjunctive_mood_imperfect_tense => "Subjunctive uses apply: commands, contrary to fact wishes, etc." ,
|
181
|
+
:active_voice_subjunctive_mood_pastperfect_tense => "Subjunctive uses apply: commands, contrary to fact wishes, etc." ,
|
182
|
+
:active_voice_subjunctive_mood_perfect_tense => "Subjunctive uses apply: commands, contrary to fact wishes, etc." ,
|
183
|
+
:active_voice_subjunctive_mood_present_tense => "Subjunctive uses apply: commands, contrary to fact wishes, etc." ,
|
184
|
+
:passive_voice_indicative_mood_future_tense => "Action to be performed on conjugant in future: 'The hamburger will be eaten.'" ,
|
185
|
+
:passive_voice_indicative_mood_futureperfect_tense => "Action is to be performed to completion on conjugant in future: 'The hamburger will have been eaten.'" ,
|
186
|
+
:passive_voice_indicative_mood_imperfect_tense => "Habitual action performed on the conjugant in the past: 'The hamburger was being eaten slowly by the BurgerHoarder.'" ,
|
187
|
+
:passive_voice_indicative_mood_pastperfect_tense => "Action was fully completed upon the conjugant at a time prior to a time in the past: 'The hamburger had been eaten before my mom came home.'" ,
|
188
|
+
:passive_voice_indicative_mood_perfect_tense => "Action was completed upon the conjugant in the past: 'The hamburger was eaten.'" ,
|
189
|
+
:passive_voice_indicative_mood_present_tense => "Conjugant is presently undergoing action in the present time: 'The hamburger is being eaten.'" ,
|
190
|
+
:passive_voice_subjunctive_mood_imperfect_tense => "Subjunctive uses apply: commands, contrary to fact wishes, etc." ,
|
191
|
+
:passive_voice_subjunctive_mood_pastperfect_tense => "Subjunctive uses apply: commands, contrary to fact wishes, etc." ,
|
192
|
+
:passive_voice_subjunctive_mood_perfect_tense => "Subjunctive uses apply: commands, contrary to fact wishes, etc." ,
|
193
|
+
:passive_voice_subjunctive_mood_present_tense => "Subjunctive uses apply: commands, contrary to fact wishes, etc."
|
194
|
+
}
|
195
|
+
# :startdoc:
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|