zhongwen_tools 0.19.2 → 0.19.6

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
- SHA1:
3
- metadata.gz: a38c8e42660f086bceb79446d9f17c8405677a15
4
- data.tar.gz: f1ddb1cf00a2b695c2e8cf04a36897139f774cfe
2
+ SHA256:
3
+ metadata.gz: 6b3c5036ea0e880cf565743282efa08945cfe60b1d9ea407177145a384a580f3
4
+ data.tar.gz: 50087ae0cb60509dfe7413b8ef48e2ca18de4fb1192f36fd93b4c008dd4d113e
5
5
  SHA512:
6
- metadata.gz: ac048dc2e9d83495eeb8c5dfa32c3fee35a2f509180549f79218b1f50eda07a840593248994a2d8c933ba91b97cc6f25af5ab6754d08dac8e0882cea39c0a122
7
- data.tar.gz: 70bfad75ce2cc6ac36b3853f9acde73e66157af51c54f582086d585a4a73d87e054b0ac9d19b20ea16a0b6c246001c8995863a2fa03a49f23a8c415420d065ae
6
+ metadata.gz: 2935bec3f50088ff3b4defbe611d147cb97303dd8d353d4ec870e75005e047c4a64cfe6291b2df4c788683243d967b120a37a135e258d68cc0194df26517f6dd
7
+ data.tar.gz: be1335fde0f93bf057d206fa5b7440aac3e356ae61a72dce04b3951704c6fbb8ea1ed083606d661fae951cecfa806a4c7815dc0879910a03d8f1da3fc5ffc10e
@@ -1,20 +1,24 @@
1
1
  # encoding: utf-8
2
- require 'zhongwen_tools/ruby_19' if RUBY_VERSION < '2.0.0'
3
- require 'zhongwen_tools/regex'
4
- require 'zhongwen_tools/fullwidth'
5
- require 'zhongwen_tools/unicode'
6
- require 'zhongwen_tools/uri'
7
- require 'zhongwen_tools/zhongwen'
8
- require 'zhongwen_tools/number'
9
- require 'zhongwen_tools/romanization'
10
- require 'zhongwen_tools/string_extension'
11
- require 'zhongwen_tools/version'
2
+ require "zhongwen_tools/ruby_19" if RUBY_VERSION < "2.0.0"
3
+ require "zhongwen_tools/regex"
4
+ require "zhongwen_tools/fullwidth"
5
+ require "zhongwen_tools/unicode"
6
+ require "zhongwen_tools/uri"
7
+ require "zhongwen_tools/zhongwen"
8
+ require "zhongwen_tools/number"
9
+ require "zhongwen_tools/romanization"
10
+ require "zhongwen_tools/string_extension"
11
+ require "zhongwen_tools/version"
12
12
 
13
13
  module ZhongwenTools
14
14
  # Allow for the use Refinements.
15
- if RUBY_VERSION >= '2.0.0'
15
+ if RUBY_VERSION >= "2.0.0"
16
16
  refine String do
17
17
  include ::ZhongwenTools::StringExtension
18
+
19
+ def respond_to?(method, include_private = false)
20
+ super || ::ZhongwenTools::StringExtension.instance_methods.include?(method)
21
+ end
18
22
  end
19
23
  end
20
24
  end
@@ -1,7 +1,6 @@
1
1
  # encoding: utf-8
2
2
  require 'zhongwen_tools/regex'
3
3
  require 'zhongwen_tools/caps'
4
- require 'zhongwen_tools/romanization'
5
4
 
6
5
  module ZhongwenTools
7
6
  # Public: Romanization converts to pinyin and pyn.
@@ -96,7 +95,8 @@ module ZhongwenTools
96
95
  #
97
96
  # Returns Boolean.
98
97
  def self.pyn?(str)
99
- # FIXME: use strip_punctuation method
98
+ return false if str =~ /a{2,}|e{2,}|i{2,}|o{2,}|u{2,}/
99
+ # FIXME: use strip_punctuation method, e.g. gsub(/\p{Punct}/, '')
100
100
  normalized_str = Caps.downcase(str.gsub(Regex.punc, '').gsub(/[\s\-]/, ''))
101
101
  pyn_arr = split_pyn(normalized_str).map { |p| p }
102
102
  pyn_arr << normalized_str if pyn_arr.size == 0 && PYN_SYLLABIC_NASALS.include?(normalized_str.gsub(/[1-5]/, ''))
@@ -113,8 +113,6 @@ module ZhongwenTools
113
113
  results.join(' ')
114
114
  end
115
115
 
116
- private
117
-
118
116
  def self.simple_tone_numbers
119
117
  @simple_tone_numbers ||= /[1-5]/
120
118
  end
@@ -245,6 +245,7 @@ ROMANIZATIONS_TABLE = [
245
245
  { bpmf: 'ㄋㄩㄝ', wg: 'nüeh', mps2: 'niue', yale: 'nywe', typy: 'nyue', pyn: 'nüe' },
246
246
  { bpmf: 'ㄋㄩㄝ', wg: 'nüeh', mps2: 'niue', yale: 'nywe', typy: 'nyue', pyn: 'nve' },
247
247
  { bpmf: 'ㄡ', wg: 'ou', mps2: 'ou', yale: 'ou', typy: 'ou', pyn: 'ou' },
248
+ { bpmf: 'ㄡ', wg: 'ou', mps2: 'ou', yale: 'ou', typy: 'ou', pyn: 'o' },
248
249
  { bpmf: 'ㄆㄚ', wg: 'p`a', mps2: 'pa', yale: 'pa', typy: 'pa', pyn: 'pa' },
249
250
  { bpmf: 'ㄆㄞ', wg: 'p`ai', mps2: 'pai', yale: 'pai', typy: 'pai', pyn: 'pai' },
250
251
  { bpmf: 'ㄆㄢ', wg: 'p`an', mps2: 'pan', yale: 'pan', typy: 'pan', pyn: 'pan' },
@@ -1,3 +1,3 @@
1
1
  module ZhongwenTools
2
- VERSION = '0.19.2'
2
+ VERSION = "0.19.6"
3
3
  end
@@ -58,6 +58,7 @@ class TestPinyin < Minitest::Test
58
58
 
59
59
  assert ZhongwenTools::Romanization::Pinyin.pyn?('ma2-fan')
60
60
  assert ZhongwenTools::Romanization::Pinyin.pyn?('yo1')
61
+ assert ZhongwenTools::Romanization::Pinyin.pyn?('O4')
61
62
  end
62
63
 
63
64
  def test_syllabic_nasal_pyn?
@@ -20,9 +20,9 @@ Gem::Specification.new do |s|
20
20
 
21
21
  s.add_development_dependency('rake', '~> 10.1')
22
22
  if RUBY_VERSION >= '1.9'
23
- s.add_development_dependency('simplecov', '~> 0.9', '>= 0.9.1')
23
+ s.add_development_dependency('simplecov', '~> 0.16', '>= 0.16.0')
24
24
  s.add_development_dependency('simplecov-gem-adapter', '~> 1.0', '>= 1.0.1')
25
- s.add_development_dependency('coveralls', '~> 0.7', '>= 0.7.0')
25
+ s.add_development_dependency('coveralls', '~> 0.8', '>= 0.8.1')
26
26
  s.add_development_dependency('minitest', '~> 5.5', '>= 5.5.1')
27
27
  s.add_development_dependency('pry', '~> 0.10', '>= 0.10.1')
28
28
  s.add_development_dependency('minitest-reporters', '~> 1.0', '>= 1.0.10')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zhongwen_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.19.2
4
+ version: 0.19.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Daniels
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-31 00:00:00.000000000 Z
11
+ date: 2019-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -30,20 +30,20 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.9'
33
+ version: '0.16'
34
34
  - - ">="
35
35
  - !ruby/object:Gem::Version
36
- version: 0.9.1
36
+ version: 0.16.0
37
37
  type: :development
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
41
  - - "~>"
42
42
  - !ruby/object:Gem::Version
43
- version: '0.9'
43
+ version: '0.16'
44
44
  - - ">="
45
45
  - !ruby/object:Gem::Version
46
- version: 0.9.1
46
+ version: 0.16.0
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: simplecov-gem-adapter
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -70,20 +70,20 @@ dependencies:
70
70
  requirements:
71
71
  - - "~>"
72
72
  - !ruby/object:Gem::Version
73
- version: '0.7'
73
+ version: '0.8'
74
74
  - - ">="
75
75
  - !ruby/object:Gem::Version
76
- version: 0.7.0
76
+ version: 0.8.1
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - "~>"
82
82
  - !ruby/object:Gem::Version
83
- version: '0.7'
83
+ version: '0.8'
84
84
  - - ">="
85
85
  - !ruby/object:Gem::Version
86
- version: 0.7.0
86
+ version: 0.8.1
87
87
  - !ruby/object:Gem::Dependency
88
88
  name: minitest
89
89
  requirement: !ruby/object:Gem::Requirement
@@ -233,7 +233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
233
233
  version: '0'
234
234
  requirements: []
235
235
  rubyforge_project: zhongwen_tools
236
- rubygems_version: 2.4.5
236
+ rubygems_version: 2.7.3
237
237
  signing_key:
238
238
  specification_version: 4
239
239
  summary: Zhongwen Tools provide romanization conversions and helper methods for Chinese.
@@ -253,4 +253,3 @@ test_files:
253
253
  - test/test_unicode.rb
254
254
  - test/test_uri.rb
255
255
  - test/test_zhongwen.rb
256
- has_rdoc: