medieval_latina 1.3.1 → 1.4.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 +4 -4
- data/.standard.yml +3 -0
- data/Gemfile.lock +1 -1
- data/lib/medieval_latina/version.rb +1 -1
- data/lib/medieval_latina.rb +29 -6
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01eca8c2e6d2b4f07f3c53c3e4ad5b8b8a965ac44eb4b83fd3336214ff48ee48
|
4
|
+
data.tar.gz: e937aaf342fe71e88dfdd30f4c370bb7be2ea623f769a2e0e01b96d82a7dc9a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 320e9b86260e6cb8842da8892eeda25a1f89b61f0f13dce652089094d88f748e7921812e5fd6443a2e25def60fa8fb37cadb53aefbed266029c1421a8d7d812b
|
7
|
+
data.tar.gz: 447bbd6c1aa938a9bc21e4b75bd27c654efb0bd7378a1733c808320eaf09f6b8b01e56c7a8f28ac7b4b46d710bcdb75554605fafe4623298c909b3513d453a9a
|
data/.standard.yml
ADDED
data/Gemfile.lock
CHANGED
data/lib/medieval_latina.rb
CHANGED
@@ -4,14 +4,24 @@ require "set"
|
|
4
4
|
|
5
5
|
class MedievalLatina
|
6
6
|
def self.[](text)
|
7
|
-
prepare_text(text).map do |
|
8
|
-
|
9
|
-
|
7
|
+
prepared_words = prepare_text(text).map do |string|
|
8
|
+
if word?(string)
|
9
|
+
DICTIONARY[string] || new(string).call
|
10
|
+
else
|
11
|
+
string
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
rejoin_words(prepared_words)
|
10
16
|
end
|
11
17
|
|
12
18
|
def self.prepare_text(text)
|
13
|
-
text.
|
14
|
-
|
19
|
+
text.scan(/[\w'-]+|[[:punct:]]+/).map do |string|
|
20
|
+
if word?(string)
|
21
|
+
prepare_word(string)
|
22
|
+
else
|
23
|
+
string
|
24
|
+
end
|
15
25
|
end
|
16
26
|
end
|
17
27
|
|
@@ -47,10 +57,23 @@ class MedievalLatina
|
|
47
57
|
NOUNS
|
48
58
|
end
|
49
59
|
|
60
|
+
def self.rejoin_words(array)
|
61
|
+
array
|
62
|
+
.join(" ")
|
63
|
+
.gsub(/ +?,/, ",")
|
64
|
+
.gsub(/ +?;/, ";")
|
65
|
+
.gsub(/ +?\./, ".")
|
66
|
+
.gsub(/ +?\?/, "?")
|
67
|
+
end
|
68
|
+
|
50
69
|
def self.verbs
|
51
70
|
VERBS
|
52
71
|
end
|
53
72
|
|
73
|
+
def self.word?(string)
|
74
|
+
string.match?(/\w/)
|
75
|
+
end
|
76
|
+
|
54
77
|
def self.words
|
55
78
|
ADJECTIVES | ADVERBS | Set.new(DICTIONARY.keys) | NOUNS | VERBS
|
56
79
|
end
|
@@ -123,7 +146,7 @@ class MedievalLatina
|
|
123
146
|
|
124
147
|
def initialize(text, index)
|
125
148
|
@character = text[index]
|
126
|
-
@rest = text[index + 1
|
149
|
+
@rest = text[index + 1..].chars.join
|
127
150
|
end
|
128
151
|
|
129
152
|
def to_team
|
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.
|
4
|
+
version: 1.4.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:
|
11
|
+
date: 2023-02-02 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.
|
@@ -22,6 +22,7 @@ files:
|
|
22
22
|
- ".github/workflows/tests.yml"
|
23
23
|
- ".gitignore"
|
24
24
|
- ".rspec"
|
25
|
+
- ".standard.yml"
|
25
26
|
- ".tool-versions"
|
26
27
|
- Gemfile
|
27
28
|
- Gemfile.lock
|