llt-constants 0.0.3

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.
@@ -0,0 +1,75 @@
1
+ #encoding: UTF-8
2
+
3
+ module LLT
4
+ module Constants
5
+ module Markers
6
+
7
+ class Verb
8
+
9
+ THEMATIC_I = "i"
10
+ THEMATIC_E = "e"
11
+ THEMATIC_U = "u"
12
+
13
+ PRAESENS_CONIUNCTIVUS_A = "e"
14
+ PRAESENS_CONIUNCTIVUS = "a"
15
+ PRAESENS_CONIUNCTIVUS_IRREGULAR = "i"
16
+
17
+ FUTURUM_A = "b"
18
+ FUTURUM_E = FUTURUM_A
19
+ FUTURUM_C = "e"
20
+ FUTURUM_I = FUTURUM_C
21
+ FUTURUM_M = FUTURUM_C
22
+ FUTURUM_C_1 = "a"
23
+ FUTURUM_M_1 = FUTURUM_C_1
24
+
25
+ IMPERFECTUM_INDICATIVUS = "ba"
26
+ IMPERFECTUM_INDICATIVUS_ESSE = "a"
27
+ IMPERFECTUM_CONIUNCTIVUS = "re"
28
+ IMPERFECTUM_CONIUNCTIVUS_LE = "le"
29
+ IMPERFECTUM_CONIUNCTIVUS_SE = "se"
30
+
31
+ STEM_ESSE_ES = "es"
32
+ STEM_ESSE_S = "s"
33
+ STEM_ESSE_E = "e"
34
+
35
+ PERFECTUM_SUFFIX_1 = "er"
36
+ PERFECTUM_SUFFIX_2 = "is"
37
+
38
+ PLUSQUAMPERFECTUM_INDICATIVUS = "a"
39
+ PLUSQUAMPERFECTUM_CONIUNCTIVUS = "se"
40
+
41
+ PERFECTUM_CONIUNCTIVUS = "i"
42
+
43
+ FUTURUM_EXACTUM_INDICATIVUS = "i"
44
+
45
+ #infinte
46
+ PRAESENS_INFINITIVUM_ACTIVUM = "re"
47
+ PRAESENS_INFINITIVUM_PASSIVUM_A = "ri"
48
+ PRAESENS_INFINITIVUM_PASSIVUM_E = PRAESENS_INFINITIVUM_PASSIVUM_A
49
+ PRAESENS_INFINITIVUM_PASSIVUM_I = PRAESENS_INFINITIVUM_PASSIVUM_A
50
+ PRAESENS_INFINITIVUM_PASSIVUM_C = "i"
51
+ PRAESENS_INFINITIVUM_PASSIVUM_M = PRAESENS_INFINITIVUM_PASSIVUM_C
52
+
53
+ PERFECTUM_INFINITIVUM_ACTIVUM = PERFECTUM_SUFFIX_2 + "se"
54
+
55
+ GERUNDIUM = "nd"
56
+ GERUNDIVUM = GERUNDIUM
57
+ PARTICIPIUM_PRAESENS_SIGN = "nt"
58
+ PARTICIPIUM_PRAESENS_SIGN_NOMINATIVE = "n"
59
+ PARTICIPIUM_FUTURUM = "ur"
60
+ SUPINUM_1 = "um"
61
+ SUPINUM_2 = "u"
62
+
63
+
64
+ class Metrical < Verb
65
+ #infinite
66
+ PRAESENS_INFINITIVUM_PASSIVUM_A = "rĭ"
67
+ PRAESENS_INFINITIVUM_PASSIVUM_C = "ĭ"
68
+ PARTICIPIUM_FUTURUM = "ūr"
69
+ SUPINUM_2 = "ū"
70
+ end
71
+ end
72
+
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,5 @@
1
+ module LLT
2
+ module Constants
3
+ VERSION = "0.0.3"
4
+ end
5
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'llt/constants/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "llt-constants"
8
+ spec.version = LLT::Constants::VERSION
9
+ spec.authors = ["LFDM", "lichtr"]
10
+ spec.email = ["1986gh@gmail.com", "robert.lichtensteiner@gmail.com"]
11
+ spec.description = %q{LLT Constants Package.}
12
+ spec.summary = %q{LLT Constants Package. Collections of latin endings, markers etc.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec"
24
+ spec.add_development_dependency "simplecov", "~> 0.7"
25
+ spec.add_development_dependency "yard"
26
+ end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ describe LLT::Constants::Endings do
4
+ let(:endings) { LLT::Constants::Endings }
5
+
6
+ describe "::Noun" do
7
+ describe ".get" do
8
+ it "retrieves endings by inflection_class and sexus, which may default to nil" do
9
+ endings::Noun.get(1).should == endings::Noun::A
10
+ endings::Noun.get(2, :n).should == endings::Noun::ON
11
+ end
12
+ end
13
+ end
14
+
15
+ describe "::Adjective" do
16
+ describe ".get" do
17
+ it "retrieves endings by inflection_class, noe and comparatio value" do
18
+ endings::Adjective.get(5, 3, :positivus).should == endings::Adjective::PRONOMINAL
19
+ endings::Adjective.get(3, 1, :comparativus).should == endings::Adjective::CONSONANTIC
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,372 @@
1
+ require 'spec_helper'
2
+
3
+ describe LLT::Constants::RegExps do
4
+ def self.example_loop(regexp, negative = false)
5
+ yield.each do |example|
6
+ str = (negative ? "doesn't match" : "matches")
7
+ it "#{str} #{example}" do
8
+ if negative
9
+ regexp.should_not match(example)
10
+ else
11
+ regexp.should match(example)
12
+ end
13
+ end
14
+ end
15
+ end
16
+
17
+ context "CASE INSENSITIVE" do
18
+ context "with irregular verbs" do
19
+ iv = LLT::Constants::RegExps::IRREGULAR_VERBS
20
+
21
+ context "with esse" do
22
+ context "in praesens" do
23
+ r = iv[:esse][:praesens].first
24
+ example_loop(r) do
25
+ %w{ sum est es eris sis sunt esto esse absumus desint Sunt }
26
+ end
27
+
28
+ example_loop(r, :negative) do
29
+ %w{ et eunt eam eum suo satis rite eas }
30
+ end
31
+
32
+ it "returns with correct components - esse" do
33
+ m = r.match("esse")
34
+ m.captures.should == ["", "es", "", "", "se"]
35
+ end
36
+
37
+ context "with prefix" do
38
+ it "returns with correct components - desum" do
39
+ m = r.match("desum")
40
+ m.captures.should == ["de", "s", "u", "", "m"]
41
+ end
42
+ end
43
+ end
44
+
45
+ context "in perfectum" do
46
+ example_loop(iv[:esse][:perfectum].first) do
47
+ %w{ fuerint fuisse fueras }
48
+ end
49
+ end
50
+ end
51
+
52
+ context "with posse" do
53
+ context "in praesens" do
54
+ r = iv[:posse][:praesens].first
55
+ example_loop(r) do
56
+ %w{ possum potest potes poteris possis possunt posse possumus }
57
+ end
58
+
59
+ example_loop(r, :negative) do
60
+ %w{ post }
61
+ end
62
+
63
+ context "returns with correct components" do
64
+ it "posse" do
65
+ m = r.match("posse")
66
+ m.captures.should == ["", "pos", "", "", "se"]
67
+ end
68
+
69
+ it "possent" do
70
+ m = r.match("possent")
71
+ m.captures.should == ["", "pos", "", "se", "nt"]
72
+ end
73
+
74
+ it "potest" do
75
+ m = r.match("potest")
76
+ m.captures.should == ["", "potes", "", "", "t"]
77
+ end
78
+ end
79
+ end
80
+
81
+ context "in perfectum" do
82
+ example_loop(iv[:posse][:perfectum].first) do
83
+ %w{ potuerint potuisse potueras potuisti potui }
84
+ end
85
+ end
86
+ end
87
+
88
+ context "with ferre" do
89
+ context "in praesens" do
90
+ r = iv[:ferre][:praesens].first
91
+ example_loop(r) do
92
+ %w{ fer ferre ferri fero fers fert ferrem feret ferat ferimus feruntur ferunto }
93
+ end
94
+
95
+ example_loop(r, :negative) do
96
+ %w{ fere ferus feri }
97
+ end
98
+
99
+ context "with verbal nouns" do
100
+ example_loop(iv[:ferre][:praesens][1]) do
101
+ %w{ ferendus ferendi ferendo ferendum ferendorum ferendis ferendos ferende
102
+ ferenda ferendae ferendarum ferendam ferendas
103
+ ferens ferentis ferenti ferentem ferente ferentes ferentium ferentibus
104
+ ferentia ferentium }
105
+ end
106
+ end
107
+
108
+ it "returns with correct components - ferre" do
109
+ m = r.match("ferre")
110
+ m.captures.should == ["", "fer", "", "", "re"]
111
+ end
112
+ end
113
+
114
+ context "in perfectum" do
115
+ example_loop(iv[:ferre][:perfectum].first) do
116
+ %w{ tulerunt tulerim tulero tulerint tulisse tuleras tulisti tuli
117
+ tulissent intulisset
118
+ contulissent }
119
+ end
120
+ end
121
+
122
+ context "in ppp" do
123
+ example_loop(iv[:ferre][:ppp].first) do
124
+ %w{ allatus latus lati lato latum late lata latae latorum latis latarum latos laturas
125
+ laturus laturi laturo laturum lature latura laturae laturorum laturis laturarum laturos latas
126
+ conlatus perlatum inlatam }
127
+ end
128
+ end
129
+ end
130
+
131
+ context "with ire" do
132
+ context "in praesens" do
133
+ context "with stem i" do
134
+ r = iv[:ire][:praesens].first
135
+ example_loop(r) do
136
+ %w{ is it imus itis ibo ibis ibunt adiberis ire iri
137
+ inito subito ito itote irem transiretur }
138
+ end
139
+
140
+ example_loop(r, :negative) do
141
+ %w{ iam ibi interim iste ista isto }
142
+ end
143
+ end
144
+
145
+ context "with stem e" do
146
+ r = iv[:ire][:praesens][1]
147
+ example_loop(r) do
148
+ %w{ eo eunt eam eas eat eamus eatis eunto subeo obeo }
149
+ end
150
+
151
+ example_loop(r, :negative) do
152
+ %w{ eos }
153
+ end
154
+ end
155
+
156
+ context "with verbal nouns" do
157
+ example_loop(iv[:ire][:praesens][2]) do
158
+ %w{ eundus abeundus eundi eundo eundum eundorum eundis eundos eunde
159
+ eunda eundae eundarum eundam eundas
160
+ iens euntis eunti euntem eunte euntes euntium euntibus
161
+ euntia euntium }
162
+ end
163
+ end
164
+ end
165
+
166
+ context "in perfectum" do
167
+ r = iv[:ire][:perfectum].first
168
+ example_loop(r) do
169
+ %w{ ierunt ierim iero ierint isse ieras isti ii }
170
+ end
171
+
172
+ example_loop(r, :negative) do
173
+ %w{ interim }
174
+ end
175
+
176
+ context "with queo and nequeo" do
177
+ r = iv[:ire][:perfectum][1]
178
+ example_loop(r) do
179
+ %w{ nequivi quivi nequisse }
180
+ end
181
+ end
182
+ end
183
+
184
+ context "in ppp" do
185
+ r = iv[:ire][:ppp].first
186
+ example_loop(r) do
187
+ # ita disabled for convenience reasons...
188
+ %w{ aditus itus iti ito itum ite itae itorum itis itarum itos ituras
189
+ iturus ituri ituro iturum iture itura iturae iturorum ituris iturarum ituros itas
190
+ inita subito inito obitum }
191
+ end
192
+
193
+ it "returns with correct components" do
194
+ m = r.match("inito")
195
+ m.captures.should == ["in", "it", "", "o"]
196
+ end
197
+ end
198
+ end
199
+
200
+ context "with velle" do
201
+ context "in praesens" do
202
+ r = iv[:velle][:praesens].first
203
+ example_loop(r) do
204
+ %w{ volo vis vult volumus vultis volunt velim velint volam voles volebant velle }
205
+ end
206
+ end
207
+
208
+ context "in perfectum" do
209
+ r = iv[:velle][:perfectum].first
210
+ example_loop(r) do
211
+ %w{ volui voluerunt voluisti volueram voluero volueritis voluisse }
212
+ end
213
+ end
214
+ end
215
+
216
+ context "with nolle" do
217
+ context "in praesens" do
218
+ r = iv[:nolle][:praesens].first
219
+ example_loop(r) do
220
+ %w{ nolo nolumus nolunt nolim nolint nolam noles nolebant nolle noli nolitote nolite nolito }
221
+ end
222
+ end
223
+
224
+ context "in perfectum" do
225
+ r = iv[:nolle][:perfectum].first
226
+ example_loop(r) do
227
+ %w{ nolui noluerunt noluisti nolueram noluero nolueritis noluisse }
228
+ end
229
+ end
230
+ end
231
+
232
+ context "with malle" do
233
+ context "in praesens" do
234
+ r = iv[:malle][:praesens].first
235
+ example_loop(r) do
236
+ %w{ malo malumus malunt malim malint malam males malebant malle }
237
+ end
238
+ end
239
+
240
+ context "in perfectum" do
241
+ r = iv[:malle][:perfectum].first
242
+ example_loop(r) do
243
+ %w{ malui maluerunt maluisti malueram maluero malueritis maluisse }
244
+ end
245
+ end
246
+ end
247
+
248
+ context "with fieri" do
249
+ context "in praesens" do
250
+ r = iv[:fieri][:praesens].first
251
+ example_loop(r) do
252
+ %w{ fio fis fit fimus fitis fiunt fiebam fiam fies fiat fierem fi fite fieri }
253
+ end
254
+
255
+ it "returns with correct components" do
256
+ m = r.match("fieri")
257
+ m.captures.should == ["fi", "e", "", "ri"]
258
+ end
259
+
260
+ it "returns with correct components" do
261
+ m = r.match("fiebam")
262
+ m.captures.should == ["fi", "e", "ba", "m"]
263
+ end
264
+
265
+ it "returns with correct components" do
266
+ m = r.match("fiebat")
267
+ m.captures.should == ["fi", "e", "ba", "t"]
268
+ end
269
+ end
270
+ end
271
+
272
+ end
273
+
274
+ context "with pronouns" do
275
+ pr = LLT::Constants::RegExps::PRONOUNS
276
+
277
+ #qui
278
+ example_loop(pr) do
279
+ %w{ qui cuius cui quem quo qui quorum quibus quos quibus
280
+ quae cuius cui Quam qua quae quarum quibus quas quibus
281
+ quod cuius cui quod quo quae quorum quibus quae quibus
282
+ quibuscum quocum quacum }.uniq
283
+ end
284
+
285
+ #quis/quid
286
+ example_loop(pr) do
287
+ %w{ quis quid }
288
+ end
289
+
290
+ #quisquam
291
+ example_loop(pr) do
292
+ %w{ quisquam quidquam quicquam }
293
+ end
294
+
295
+ #quisquis
296
+ example_loop(pr) do
297
+ %w{ quisquis quidquid quoquo }
298
+ end
299
+
300
+ #unusquisque
301
+ example_loop(pr) do
302
+ %w{ unusquisque uniuscuiusque }
303
+ end
304
+
305
+ example_loop(pr, :negative) do
306
+ %w{ undique }
307
+ end
308
+
309
+ # hic
310
+ example_loop(pr) do
311
+ %w{ hic huius huic hunc hoc hi horum his hos his
312
+ haec Huius huic hanc hac hae harum his has his
313
+ hoc huius huic hoc hoc haec horum his haec his }.uniq
314
+ end
315
+
316
+ example_loop(pr, :negative) do
317
+ %w{ hiscum }
318
+ end
319
+
320
+ # ipse
321
+ example_loop(pr) do
322
+ %w{ ipse ipsa ipsum ipsis }
323
+ end
324
+
325
+ # is
326
+ example_loop(pr) do
327
+ %w{ is ea id eius ei }
328
+ end
329
+
330
+ example_loop(pr, :negative) do
331
+ %w{ iam }
332
+ end
333
+
334
+ # idem
335
+ example_loop(pr) do
336
+ %w{ idem eadem iisdem isdem }
337
+ end
338
+
339
+ # quispiam
340
+ example_loop(pr) do
341
+ %w{ quispiam }
342
+ end
343
+
344
+ # aliqui
345
+ example_loop(pr) do
346
+ %w{ aliquo alicuius }
347
+ end
348
+
349
+ example_loop(pr, :negative) do
350
+ %w{ aliis aliquibuscum }
351
+ end
352
+
353
+ it "matches uterque" do
354
+ pr.should match("uterque")
355
+ end
356
+
357
+ example_loop(pr, :negative) do
358
+ %w{ quidem }
359
+ end
360
+
361
+ it "has proper captures" do
362
+ pr.match("aliqui").captures.should == ["ali", "qu", "i", nil, nil]
363
+ pr.match("hi") .captures.should == [nil, "h", "i", nil, nil]
364
+ pr.match("hunc") .captures.should == [nil, "h", "un", "c", nil]
365
+ pr.match("isdem") .captures.should == [nil, "i", "s", "dem", nil]
366
+ pr.match("quocum").captures.should == [nil, "qu", "o", nil, "cum"]
367
+ pr.match("quonam").captures.should == [nil, "qu", "o", "nam", nil]
368
+ pr.match("unusquisque").captures.should == ["unus", "qu", "is", "que", nil]
369
+ end
370
+ end
371
+ end
372
+ end