zhongwen_tools 0.19.2 → 0.19.6
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 +5 -5
- data/lib/zhongwen_tools/core.rb +15 -11
- data/lib/zhongwen_tools/romanization/pinyin.rb +2 -4
- data/lib/zhongwen_tools/romanization/romanization_table.rb +1 -0
- data/lib/zhongwen_tools/version.rb +1 -1
- data/test/test_pinyin.rb +1 -0
- data/zhongwen_tools.gemspec +2 -2
- metadata +11 -12
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 6b3c5036ea0e880cf565743282efa08945cfe60b1d9ea407177145a384a580f3
|
|
4
|
+
data.tar.gz: 50087ae0cb60509dfe7413b8ef48e2ca18de4fb1192f36fd93b4c008dd4d113e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2935bec3f50088ff3b4defbe611d147cb97303dd8d353d4ec870e75005e047c4a64cfe6291b2df4c788683243d967b120a37a135e258d68cc0194df26517f6dd
|
|
7
|
+
data.tar.gz: be1335fde0f93bf057d206fa5b7440aac3e356ae61a72dce04b3951704c6fbb8ea1ed083606d661fae951cecfa806a4c7815dc0879910a03d8f1da3fc5ffc10e
|
data/lib/zhongwen_tools/core.rb
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
# encoding: utf-8
|
|
2
|
-
require
|
|
3
|
-
require
|
|
4
|
-
require
|
|
5
|
-
require
|
|
6
|
-
require
|
|
7
|
-
require
|
|
8
|
-
require
|
|
9
|
-
require
|
|
10
|
-
require
|
|
11
|
-
require
|
|
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 >=
|
|
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
|
-
|
|
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' },
|
data/test/test_pinyin.rb
CHANGED
data/zhongwen_tools.gemspec
CHANGED
|
@@ -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.
|
|
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.
|
|
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.
|
|
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:
|
|
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.
|
|
33
|
+
version: '0.16'
|
|
34
34
|
- - ">="
|
|
35
35
|
- !ruby/object:Gem::Version
|
|
36
|
-
version: 0.
|
|
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.
|
|
43
|
+
version: '0.16'
|
|
44
44
|
- - ">="
|
|
45
45
|
- !ruby/object:Gem::Version
|
|
46
|
-
version: 0.
|
|
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.
|
|
73
|
+
version: '0.8'
|
|
74
74
|
- - ">="
|
|
75
75
|
- !ruby/object:Gem::Version
|
|
76
|
-
version: 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.
|
|
83
|
+
version: '0.8'
|
|
84
84
|
- - ">="
|
|
85
85
|
- !ruby/object:Gem::Version
|
|
86
|
-
version: 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.
|
|
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:
|