medieval_latina 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +6 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +55 -0
- data/LICENSE.txt +21 -0
- data/README.md +47 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/medieval_latina.rb +66 -0
- data/lib/medieval_latina/version.rb +3 -0
- data/medieval_latina.gemspec +31 -0
- metadata +62 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: da322f2df21a563b5167ab36f5f117a85f671561e2074813f19ce9195c7c4c03
|
4
|
+
data.tar.gz: 31f6c7ba58353d7dca2e2fefc959ab7b39a870a760ba46537c7d499f40d56b77
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a98763a2f789447e22a9724e3b222e1f50cbdea95367f1f282b6ae644c68bae257b255fafd08e6765fc4173ad4b1585545855f32f786769f3022b0e522b6f7e5
|
7
|
+
data.tar.gz: b70ce132468367255306db3106908d5d066697cf642b09d5e301710b433271663866e8f5a23e3f489be2f12b922aa8892a10c1e3f0ed5721349c94cc9ec6dcb0
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
medieval_latina (1.0.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
ast (2.4.0)
|
10
|
+
diff-lcs (1.3)
|
11
|
+
parallel (1.19.1)
|
12
|
+
parser (2.7.1.2)
|
13
|
+
ast (~> 2.4.0)
|
14
|
+
rainbow (3.0.0)
|
15
|
+
rake (12.3.3)
|
16
|
+
rexml (3.2.4)
|
17
|
+
rspec (3.9.0)
|
18
|
+
rspec-core (~> 3.9.0)
|
19
|
+
rspec-expectations (~> 3.9.0)
|
20
|
+
rspec-mocks (~> 3.9.0)
|
21
|
+
rspec-core (3.9.2)
|
22
|
+
rspec-support (~> 3.9.3)
|
23
|
+
rspec-expectations (3.9.2)
|
24
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
25
|
+
rspec-support (~> 3.9.0)
|
26
|
+
rspec-mocks (3.9.1)
|
27
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
28
|
+
rspec-support (~> 3.9.0)
|
29
|
+
rspec-support (3.9.3)
|
30
|
+
rubocop (0.83.0)
|
31
|
+
parallel (~> 1.10)
|
32
|
+
parser (>= 2.7.0.1)
|
33
|
+
rainbow (>= 2.2.2, < 4.0)
|
34
|
+
rexml
|
35
|
+
ruby-progressbar (~> 1.7)
|
36
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
37
|
+
rubocop-performance (1.5.2)
|
38
|
+
rubocop (>= 0.71.0)
|
39
|
+
ruby-progressbar (1.10.1)
|
40
|
+
standard (0.4.2)
|
41
|
+
rubocop (~> 0.83.0)
|
42
|
+
rubocop-performance (~> 1.5.2)
|
43
|
+
unicode-display_width (1.7.0)
|
44
|
+
|
45
|
+
PLATFORMS
|
46
|
+
ruby
|
47
|
+
|
48
|
+
DEPENDENCIES
|
49
|
+
medieval_latina!
|
50
|
+
rake (~> 12.0)
|
51
|
+
rspec (~> 3.0)
|
52
|
+
standard
|
53
|
+
|
54
|
+
BUNDLED WITH
|
55
|
+
2.1.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Jayson Virissimo
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# MedievalLatina
|
2
|
+
|
3
|
+
There are good text-to-speech engines for English and classical Latin, but none for medieval Latin.
|
4
|
+
`MedievalLatina` converts Latin text to a kind of phonetic spelling that can be read by English text-to-speech engines.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'medieval_latina'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle install
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install medieval_latina
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
["deus", "luna", "via"].each { |word| puts MedievalLatina[word] }
|
26
|
+
# "dayoos"
|
27
|
+
# "loonah"
|
28
|
+
# "veeah"
|
29
|
+
```
|
30
|
+
|
31
|
+
## Development
|
32
|
+
|
33
|
+
After checking out the repo, run `bin/setup` to install dependencies.
|
34
|
+
Then, run `rake spec` to run the tests.
|
35
|
+
You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
36
|
+
|
37
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
38
|
+
To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
39
|
+
Run `standardrb --fix` before submitting any changes, to help keep the code formatting uniform.
|
40
|
+
|
41
|
+
## Contributing
|
42
|
+
|
43
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/jaysonvirissimo/medieval_latina.
|
44
|
+
|
45
|
+
## License
|
46
|
+
|
47
|
+
The gem is available as open source under the terms of the [MIT License](https://github.com/jaysonvirissimo/medieval_latina/blob/master/LICENSE.txt).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "medieval_latina"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
require "medieval_latina/version"
|
2
|
+
|
3
|
+
class MedievalLatina
|
4
|
+
def self.[](text)
|
5
|
+
new(text).call
|
6
|
+
end
|
7
|
+
|
8
|
+
def initialize(text)
|
9
|
+
@index = 0
|
10
|
+
@text = text
|
11
|
+
end
|
12
|
+
|
13
|
+
def call
|
14
|
+
array = []
|
15
|
+
|
16
|
+
until index >= text.length
|
17
|
+
character = text[index]
|
18
|
+
rest = text.chars.drop(index + 1).join
|
19
|
+
result = vowel(character, rest.chars.first) || consonent(character, rest)
|
20
|
+
array.push(result.substring)
|
21
|
+
self.index = index + result.increment_by
|
22
|
+
end
|
23
|
+
|
24
|
+
array.join("")
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
attr_accessor :index
|
30
|
+
attr_reader :text
|
31
|
+
|
32
|
+
CONSONENTS = {
|
33
|
+
c: ->(rest) { SOFT_C.any? { |item| rest.start_with?(item) } ? "ch" : "k" },
|
34
|
+
g: ->(rest) { SOFT_G.any? { |item| rest.start_with?(item) } ? "j" : "g" },
|
35
|
+
j: ->(rest) { "y" }
|
36
|
+
}
|
37
|
+
SOFT_C = ["e", "i", "ae", "oe"]
|
38
|
+
SOFT_G = SOFT_C
|
39
|
+
VOWEL_TEAMS = {ae: "ay", oe: "ay", au: "ow"}
|
40
|
+
VOWELS = {a: "ah", e: "ay", i: "ee", o: "oh", u: "oo"}
|
41
|
+
|
42
|
+
Result = Struct.new(:substring, :increment_by)
|
43
|
+
|
44
|
+
def consonent(character, rest)
|
45
|
+
consonent = if CONSONENTS.key?(character.intern)
|
46
|
+
CONSONENTS[character.intern].call(rest)
|
47
|
+
else
|
48
|
+
character
|
49
|
+
end
|
50
|
+
|
51
|
+
Result.new(consonent, 1)
|
52
|
+
end
|
53
|
+
|
54
|
+
def vowel(character, next_character)
|
55
|
+
vowel_team = VOWEL_TEAMS["#{character}#{next_character}".intern]
|
56
|
+
vowel = VOWELS[character.intern]
|
57
|
+
|
58
|
+
if vowel_team
|
59
|
+
Result.new(vowel_team, 2)
|
60
|
+
elsif vowel
|
61
|
+
Result.new(vowel, 1)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
class Error < StandardError; end
|
66
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require_relative "lib/medieval_latina/version"
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
description = <<~HEREDOC
|
5
|
+
There are good text-to-speech engines for English and classical Latin, but none for medieval Latin.
|
6
|
+
MedievalLatina converts Latin text to a kind of phonetic spelling that can be read by English text-to-speech engines.
|
7
|
+
HEREDOC
|
8
|
+
github_uri = "https://github.com/jaysonvirissimo/medieval_latina"
|
9
|
+
|
10
|
+
spec.name = "medieval_latina"
|
11
|
+
spec.version = MedievalLatina::VERSION
|
12
|
+
spec.authors = ["Jayson Virissimo"]
|
13
|
+
spec.email = ["jayson.virissimo@asu.edu"]
|
14
|
+
spec.summary = "Transform medieval Latin text into phonetic English"
|
15
|
+
spec.description = description
|
16
|
+
spec.homepage = "https://github.com/jaysonvirissimo/medieval_latina"
|
17
|
+
spec.license = "MIT"
|
18
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
19
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org/"
|
20
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
21
|
+
spec.metadata["source_code_uri"] = github_uri
|
22
|
+
spec.metadata["changelog_uri"] = github_uri
|
23
|
+
# Specify which files should be added to the gem when it is released.
|
24
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
25
|
+
spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
|
26
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
27
|
+
end
|
28
|
+
spec.bindir = "exe"
|
29
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
30
|
+
spec.require_paths = ["lib"]
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: medieval_latina
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jayson Virissimo
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-05-23 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: |
|
14
|
+
There are good text-to-speech engines for English and classical Latin, but none for medieval Latin.
|
15
|
+
MedievalLatina converts Latin text to a kind of phonetic spelling that can be read by English text-to-speech engines.
|
16
|
+
email:
|
17
|
+
- jayson.virissimo@asu.edu
|
18
|
+
executables: []
|
19
|
+
extensions: []
|
20
|
+
extra_rdoc_files: []
|
21
|
+
files:
|
22
|
+
- ".gitignore"
|
23
|
+
- ".rspec"
|
24
|
+
- ".travis.yml"
|
25
|
+
- Gemfile
|
26
|
+
- Gemfile.lock
|
27
|
+
- LICENSE.txt
|
28
|
+
- README.md
|
29
|
+
- Rakefile
|
30
|
+
- bin/console
|
31
|
+
- bin/setup
|
32
|
+
- lib/medieval_latina.rb
|
33
|
+
- lib/medieval_latina/version.rb
|
34
|
+
- medieval_latina.gemspec
|
35
|
+
homepage: https://github.com/jaysonvirissimo/medieval_latina
|
36
|
+
licenses:
|
37
|
+
- MIT
|
38
|
+
metadata:
|
39
|
+
allowed_push_host: https://rubygems.org/
|
40
|
+
homepage_uri: https://github.com/jaysonvirissimo/medieval_latina
|
41
|
+
source_code_uri: https://github.com/jaysonvirissimo/medieval_latina
|
42
|
+
changelog_uri: https://github.com/jaysonvirissimo/medieval_latina
|
43
|
+
post_install_message:
|
44
|
+
rdoc_options: []
|
45
|
+
require_paths:
|
46
|
+
- lib
|
47
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: 2.3.0
|
52
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
requirements: []
|
58
|
+
rubygems_version: 3.0.3
|
59
|
+
signing_key:
|
60
|
+
specification_version: 4
|
61
|
+
summary: Transform medieval Latin text into phonetic English
|
62
|
+
test_files: []
|