chinese_pinyin 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/lib/chinese_pinyin.rb +2 -1
- data/lib/chinese_pinyin/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ebb9e7b3731b3149a52eef70e0c81730903628cf
|
4
|
+
data.tar.gz: 4d78cbe68ffabbf97de7f3755be7cf4017ea945c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4da5ebcbd2cfaea171ccfc0868788c69eabd27e16b7459e0a9b75981d5b89adf0747f930b8528541ed6b41493f9942b7629590f437e8df2a4a7611e8dec5d54c
|
7
|
+
data.tar.gz: 60ada2ec4e9503f35f705759f1b8cf3f49d3103768e6e158f05bae7ad0225e1f915694628743b4c69556cf2d02d4d911960264fc265de1c5adc01e96636dcbe0
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
data/lib/chinese_pinyin.rb
CHANGED
@@ -26,7 +26,7 @@ class Pinyin
|
|
26
26
|
datfile = @ruby2 ? 'pinyin-utf8.dat' : 'Mandarin.dat'
|
27
27
|
@table = {}
|
28
28
|
|
29
|
-
File.open(File.dirname(__FILE__) + "/../data/#{datfile}") do |file|
|
29
|
+
File.open(File.dirname(__FILE__) + "/../data/#{datfile}", "r:UTF-8",) do |file|
|
30
30
|
while line = file.gets
|
31
31
|
key, value = line.split(' ', 2)
|
32
32
|
@table[key] = value
|
@@ -50,6 +50,7 @@ class Pinyin
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def translate(chars, options={})
|
53
|
+
chars = chars.force_encoding("UTF-8")
|
53
54
|
splitter = options.fetch(:splitter, ' ')
|
54
55
|
tonemarks = options.fetch(:tonemarks, false)
|
55
56
|
tone = options.fetch(:tone, false || tonemarks)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chinese_pinyin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Huang
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2016-07-06 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: translate chinese hanzi to pinyin.
|
15
15
|
email:
|
@@ -56,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
56
56
|
version: 1.3.6
|
57
57
|
requirements: []
|
58
58
|
rubyforge_project:
|
59
|
-
rubygems_version: 2.
|
59
|
+
rubygems_version: 2.5.1
|
60
60
|
signing_key:
|
61
61
|
specification_version: 4
|
62
62
|
summary: translate chinese hanzi to pinyin.
|