rudge 0.0.4 → 0.0.5

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
  SHA1:
3
- metadata.gz: edb0b387c52111c285a56e7b82a53ac8633ae9c7
4
- data.tar.gz: 80f1c6b8d41f115e59d299a9437dce9f7143e8aa
3
+ metadata.gz: 28ba0cef0025ab229bf1839fe3f2b39d1629efe2
4
+ data.tar.gz: c6d0b88fc57c12726709fca953122fbca9f47588
5
5
  SHA512:
6
- metadata.gz: 1a76d44632d5a827bdc5e0690a9ae37559db4b70cb8eef074d8863e5f7d969746c72db2eaf75737e4cdbfb7e0b8097a90328f2f6811a04597ecbfbf2997041cf
7
- data.tar.gz: b50d07dd26c9609112715f1832cc368d23dd9d5454f170d369da28f970bcb978001aba4ed3c4f2d668c9fd278ce2e0223953dd847cd489a8e3b1bcb9782ee307
6
+ metadata.gz: 07346e1f5a07b4103ee0ba89bdf102a551b76cc79a9d573a17f96a0e430a085514adfbe5fc94de6e8a66a036739ed036bc0eb005a71be4a578f4a2a9f69253c4
7
+ data.tar.gz: 7f509f26b478468682b6b32be2e2ba279521c47b5620cf40088880280190fad40b2a21d1de6651a1239cc4bedc44418870ea4251af263b651ed082a6b6acbf33
data/lib/rudge.rb CHANGED
@@ -1,14 +1,13 @@
1
- require 'rudge/abbreviations'
1
+ require "rudge/abbreviations"
2
2
 
3
3
  class Rudge
4
-
5
4
  # end of sentence marker
6
5
  EOS = "\001"
7
6
 
8
7
  def self.sentences(text)
9
8
  text = text.dup
10
9
 
11
- # initial split after punctuation,
10
+ # initial split after punctuation,
12
11
  # preserves trailing whitespace for the ellipsis correction
13
12
  text.gsub!(/([\.?!](?:\"|\'|\)|\]|\})?)(\s+)/) { $1 << EOS << $2 }
14
13
 
@@ -16,7 +15,7 @@ class Rudge
16
15
  text.gsub!(/(\.\.\.*)#{EOS}/) { $1 }
17
16
 
18
17
  # correct abbreviations - precompile regexp?
19
- text.gsub!(/(#{Rudge::Abbreviations.list.join("|")})\.#{EOS}/i) { $1 << '.' }
18
+ text.gsub!(/\s(#{Rudge::Abbreviations.list.join("|")})\.#{EOS}/i) { " " << $1 << "." }
20
19
 
21
20
  # split on EOS marker, strip gets rid of trailing whitespace
22
21
  text.split(EOS).map { | sentence | sentence.strip }
@@ -14,9 +14,7 @@ class Rudge
14
14
  MISC = %w(vs etc no esp cf)
15
15
 
16
16
  def self.list
17
- list = TITLES + ENTITIES + MONTHS + DAYS + ADDRESSES + MISC
18
- list = list + list.map { |a| a.capitalize}
17
+ TITLES + ENTITIES + MONTHS + DAYS + ADDRESSES + MISC
19
18
  end
20
-
21
19
  end
22
20
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rudge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - bruno coelho