medieval_latina 1.2.6 → 1.3.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5c51019ce8838474d3c42b3f60fac0fcba9ea58b115085b70463b53ff2f2a83a
4
- data.tar.gz: db4cc95c881fd2fc17164eee3b0896041b6108f372ab63f5fc2bb8e9ef993784
3
+ metadata.gz: 76d9ee49f0f6769ceaf009a097b7966c4ac453e946fcc97135e8706d9e45f051
4
+ data.tar.gz: 47321a09e37698234ea721dc9934852668032158ba82c3f3e2792accf5fae837
5
5
  SHA512:
6
- metadata.gz: f21d321debe69c6fe9ff3be089b1769ab1c546cc08568f451d56175a95e5b291b0dc19b616150805795ed8f01131b1d3df5f5d6c3d8354c26c341015ea15c94d
7
- data.tar.gz: ca2a3df1b62b1f255b43462183763757f8167f491468472026750635c9a1a15de115793e3aae76eeacc7d4b56f418bda2758b6e238a6c712a8c707205c50f2fb
6
+ metadata.gz: 6802714afcad8201d94f5d03fa1131d980aa33fd38f24333f5596da24800e4791c79f70d7b6a0947dafdf6713e25779fdc6680a35ddd8e00bd1257080f8a98ad
7
+ data.tar.gz: 5a4ea8dce20962c4ffdb43dde5c81e9bdfff459989b9c70c11027227e81526ab4c09e2972d959d3d85eaf40bb72a42d7fd5d734820506cf3a200a18e10620e5d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- medieval_latina (1.2.6)
4
+ medieval_latina (1.3.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,3 +1,5 @@
1
+ require "set"
2
+
1
3
  class MedievalLatina
2
4
  DICTIONARY = {
3
5
  "ad" => "add",
@@ -154,7 +156,7 @@ class MedievalLatina
154
156
  velox
155
157
  verus
156
158
  vetus
157
- ].freeze
159
+ ].to_set.freeze
158
160
 
159
161
  ADVERBS = %w[
160
162
  abhinc
@@ -213,7 +215,7 @@ class MedievalLatina
213
215
  utinam
214
216
  vere
215
217
  vix
216
- ].freeze
218
+ ].to_set.freeze
217
219
 
218
220
  VERBS = %w[
219
221
  abeo
@@ -443,5 +445,5 @@ class MedievalLatina
443
445
  voco
444
446
  volo
445
447
  vulnero
446
- ].freeze
448
+ ].to_set.freeze
447
449
  end
@@ -1,3 +1,3 @@
1
1
  class MedievalLatina
2
- VERSION = "1.2.6".freeze
2
+ VERSION = "1.3.0".freeze
3
3
  end
@@ -4,13 +4,31 @@ require "set"
4
4
 
5
5
  class MedievalLatina
6
6
  def self.[](text)
7
- prepare(text).map do |word|
7
+ prepare_text(text).map do |word|
8
8
  DICTIONARY[word] || new(word).call
9
9
  end.join(" ")
10
10
  end
11
11
 
12
- def self.prepare(text)
13
- text.gsub(/\W+/, " ").downcase.split(" ")
12
+ def self.prepare_text(text)
13
+ text.split(" ").map do |word|
14
+ prepare_word(word)
15
+ end
16
+ end
17
+
18
+ def self.prepare_word(word)
19
+ word.gsub(/\W+/, " ").strip.downcase
20
+ end
21
+
22
+ def self.adjective?(word)
23
+ ADJECTIVES.member?(prepare_word(word))
24
+ end
25
+
26
+ def self.adverb?(word)
27
+ ADVERBS.member?(prepare_word(word))
28
+ end
29
+
30
+ def self.verb?(word)
31
+ VERBS.member?(prepare_word(word))
14
32
  end
15
33
 
16
34
  def self.adjectives
@@ -25,6 +43,10 @@ class MedievalLatina
25
43
  VERBS
26
44
  end
27
45
 
46
+ def self.words
47
+ ADJECTIVES | ADVERBS | Set.new(DICTIONARY.keys) | VERBS
48
+ end
49
+
28
50
  def initialize(word)
29
51
  @index = 0
30
52
  @word = word.downcase
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: medieval_latina
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.6
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jayson Virissimo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-15 00:00:00.000000000 Z
11
+ date: 2022-12-18 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
14
  There are good text-to-speech engines for English and classical Latin, but none for medieval Latin.