klang 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -1
- data/lib/klang/version.rb +1 -1
- data/lib/klang.rb +10 -10
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14ea815448bff6f7591cc2f45d9519be61155abb
|
4
|
+
data.tar.gz: e6dc3c138a79f7e86899a8df65e90c7b89db1372
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efcd8fa717fe871d8d80ab17f6959a754b6ddef802af2e04314875cd07d08a6c0e2ee6ff5c06018786ba0e7785c7520a1f9d8cc180e1d4bd429ba164b33883ee
|
7
|
+
data.tar.gz: c5d29825c54c67d597187a47c9169cd2415565b75ea76d47345e6e2242935f0ae0adf62cbdcda9ed351cc4d20dc9be127b943c61d7e88fd1baace4aa65883d48
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Klang
|
2
2
|
|
3
|
-
Parse korean
|
3
|
+
Parse korean hangul language.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -25,6 +25,11 @@ word = '아'
|
|
25
25
|
Klang::Klang.new(word).to_alphabet # => a
|
26
26
|
```
|
27
27
|
|
28
|
+
```ruby
|
29
|
+
Klang::Klang.hangul? '아' # => true
|
30
|
+
Klang::Klang.hangul? 'あ' # => false
|
31
|
+
```
|
32
|
+
|
28
33
|
## Contributing
|
29
34
|
|
30
35
|
1. Fork it ( https://github.com/[my-github-username]/klang/fork )
|
data/lib/klang/version.rb
CHANGED
data/lib/klang.rb
CHANGED
@@ -77,6 +77,15 @@ module Klang
|
|
77
77
|
0x11C2 => 'h', # ㅎ
|
78
78
|
}
|
79
79
|
|
80
|
+
def self.hangul?(char)
|
81
|
+
o = char.ord
|
82
|
+
((o >= 0x1100 && o <= 0x11FF) ||
|
83
|
+
(o >= 0xA960 && o <= 0xA97F) ||
|
84
|
+
(o >= 0xD7B0 && o <= 0xD7FF) ||
|
85
|
+
(o >= 0x3130 && o <= 0x318F) ||
|
86
|
+
(o >= 0xAC00 && o <= 0xD7AF))
|
87
|
+
end
|
88
|
+
|
80
89
|
def initialize(str)
|
81
90
|
@raw = str
|
82
91
|
@alphabet = nil
|
@@ -91,7 +100,7 @@ module Klang
|
|
91
100
|
def parse_hangul
|
92
101
|
alpha = []
|
93
102
|
@raw.each_char do |c|
|
94
|
-
unless hangul?(c)
|
103
|
+
unless Klang.hangul?(c)
|
95
104
|
alpha << c
|
96
105
|
next
|
97
106
|
end
|
@@ -102,14 +111,5 @@ module Klang
|
|
102
111
|
end
|
103
112
|
@alphabet = alpha.join
|
104
113
|
end
|
105
|
-
|
106
|
-
def hangul?(char)
|
107
|
-
o = char.ord
|
108
|
-
((o >= 0x1100 && o <= 0x11FF) ||
|
109
|
-
(o >= 0xA960 && o <= 0xA97F) ||
|
110
|
-
(o >= 0xD7B0 && o <= 0xD7FF) ||
|
111
|
-
(o >= 0x3130 && o <= 0x318F) ||
|
112
|
-
(o >= 0xAC00 && o <= 0xD7AF))
|
113
|
-
end
|
114
114
|
end
|
115
115
|
end
|
metadata
CHANGED
@@ -1,55 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: klang
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- shunirr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-11-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.7'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.7'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '10.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: unicode
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
description: Parse korean hangle language.
|
@@ -59,7 +59,7 @@ executables: []
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
-
- .gitignore
|
62
|
+
- ".gitignore"
|
63
63
|
- Gemfile
|
64
64
|
- LICENSE.txt
|
65
65
|
- README.md
|
@@ -77,17 +77,17 @@ require_paths:
|
|
77
77
|
- lib
|
78
78
|
required_ruby_version: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
84
|
requirements:
|
85
|
-
- -
|
85
|
+
- - ">="
|
86
86
|
- !ruby/object:Gem::Version
|
87
87
|
version: '0'
|
88
88
|
requirements: []
|
89
89
|
rubyforge_project:
|
90
|
-
rubygems_version: 2.
|
90
|
+
rubygems_version: 2.6.8
|
91
91
|
signing_key:
|
92
92
|
specification_version: 4
|
93
93
|
summary: Parse korean hangle language.
|