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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 66ce3f49a49e5a7d8d8ce908a655143619d6285ce28eafd8387d6a34cc877c1a
4
- data.tar.gz: a6913134d94db3e7d86070a1879dc4f89333f28cbf442fc47dcd48793d45553a
3
+ metadata.gz: 4fb30498f15ce0e4ff9b7b7e773dbfa36ed5da395b5a7599345f7c4f05b90e2a
4
+ data.tar.gz: 1fd0f7637559568e4c76e65a3e5a18350e2fb97004a6ca385dec61084b972c23
5
5
  SHA512:
6
- metadata.gz: fb1a9a134b181674583585a65829a65574de134b36cc4d9deeace40e54a2762b6e8109864a623284cfdb1b95b937a26819a5200dbc6d15c27c52a3eb7aa40950
7
- data.tar.gz: 2dfbd12278b8487bc3ef7de74f05658ad37311adc1ad2389c8af6c7c223cf7e8fc7b01dfc61d85c0f6928118682d343cadc88334f5af48e5c68b53245b0f41ee
6
+ metadata.gz: 4f928bdd12c37f4e2de41d52527d562d79e1da32abb9c1efbc63e4121a68b9b68827002ffa30023c93fa59f1785262bf3bdc51c09502cfb3023af8fa5e38168d
7
+ data.tar.gz: 11bc3bddf13d84080c3c526e09515ca3aa19a477bec2da343eb9a50fca38d9fe414549016d513ac977132fba06b6a3470a2dfaec0ade35a803c08374a717ab8c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- medieval_latina (1.1.7)
4
+ medieval_latina (1.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,3 +1,3 @@
1
1
  class MedievalLatina
2
- VERSION = "1.1.7"
2
+ VERSION = "1.2.0"
3
3
  end
@@ -4,19 +4,13 @@ require "set"
4
4
 
5
5
  class MedievalLatina
6
6
  def self.[](text)
7
- clean(text).split(" ").map { |word|
8
- DICTIONARY[word.downcase] || new(word).call
9
- }.join(" ")
7
+ prepare(text).map do |word|
8
+ DICTIONARY[word] || new(word).call
9
+ end.join(" ")
10
10
  end
11
11
 
12
- def self.clean(text)
13
- text.chars.map do |character|
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: medieval_latina
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.7
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jayson Virissimo