medieval_latina 1.1.7 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/medieval_latina/version.rb +1 -1
- data/lib/medieval_latina.rb +5 -12
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4fb30498f15ce0e4ff9b7b7e773dbfa36ed5da395b5a7599345f7c4f05b90e2a
|
4
|
+
data.tar.gz: 1fd0f7637559568e4c76e65a3e5a18350e2fb97004a6ca385dec61084b972c23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f928bdd12c37f4e2de41d52527d562d79e1da32abb9c1efbc63e4121a68b9b68827002ffa30023c93fa59f1785262bf3bdc51c09502cfb3023af8fa5e38168d
|
7
|
+
data.tar.gz: 11bc3bddf13d84080c3c526e09515ca3aa19a477bec2da343eb9a50fca38d9fe414549016d513ac977132fba06b6a3470a2dfaec0ade35a803c08374a717ab8c
|
data/Gemfile.lock
CHANGED
data/lib/medieval_latina.rb
CHANGED
@@ -4,19 +4,13 @@ require "set"
|
|
4
4
|
|
5
5
|
class MedievalLatina
|
6
6
|
def self.[](text)
|
7
|
-
|
8
|
-
DICTIONARY[word
|
9
|
-
|
7
|
+
prepare(text).map do |word|
|
8
|
+
DICTIONARY[word] || new(word).call
|
9
|
+
end.join(" ")
|
10
10
|
end
|
11
11
|
|
12
|
-
def self.
|
13
|
-
text.
|
14
|
-
if PUNCTUATION.member?(character)
|
15
|
-
" "
|
16
|
-
else
|
17
|
-
character
|
18
|
-
end
|
19
|
-
end.join
|
12
|
+
def self.prepare(text)
|
13
|
+
text.gsub(/\W+/, " ").downcase.split(" ")
|
20
14
|
end
|
21
15
|
|
22
16
|
def initialize(word)
|
@@ -50,7 +44,6 @@ class MedievalLatina
|
|
50
44
|
x: ->(rest) { "ks" }
|
51
45
|
}
|
52
46
|
CONSONENT_TEAMS = {gn: "n-y", qu: "kw"}.freeze
|
53
|
-
PUNCTUATION = Set.new([".", ",", "!"]).freeze
|
54
47
|
SOFT_C = ["e", "i", "ae", "oe"].freeze
|
55
48
|
SOFT_G = SOFT_C
|
56
49
|
SOFT_T = ["i"].freeze
|