ununiga 1.0.5 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/LICENSE.txt +22 -0
- data/lib/ununiga/jaso_splitter.rb +1 -1
- data/lib/ununiga/josa_picker.rb +1 -1
- data/test/test_jaso_splitter.rb +11 -4
- data/test/test_josa_picker.rb +1 -1
- data/test/test_josa_transformer.rb +1 -1
- data/ununiga.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a6cd6f64015b8f7953b7f137dde4cb518d83570
|
4
|
+
data.tar.gz: 3eecc09dad0872f94113a0c881e1e2433963824d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f62ec9fb9ececf09c436b3569ea5576d1deccb9bcc6ace422ec35110611b422abb1a2899a1c8881263163946013596d890e2834dff1d1e9033bd2b4fba56fde1
|
7
|
+
data.tar.gz: a9e280ed653d7fa8495c8f571209fea16c212846c53502a322cbeedf861b7e5b19c07edcf0fdac419dd3c22ff697db09edfb89a50cd13da6db954a3424da4255
|
data/Gemfile.lock
CHANGED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 keepcosmos
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
22
|
+
|
@@ -17,7 +17,7 @@ module Ununiga
|
|
17
17
|
#
|
18
18
|
class JasoSplitter
|
19
19
|
CHOSUNGS = %w(ㄱ ㄲ ㄴ ㄷ ㄸ ㄹ ㅁ ㅂ ㅃ ㅅ ㅆ ㅇ ㅈ ㅉ ㅊ ㅋ ㅌ ㅍ ㅎ).freeze
|
20
|
-
JUNGSUNGS = %w(ㅏ ㅐ ㅑ ㅒ ㅓ ㅔ ㅕ ㅖ ㅗ ㅘ
|
20
|
+
JUNGSUNGS = %w(ㅏ ㅐ ㅑ ㅒ ㅓ ㅔ ㅕ ㅖ ㅗ ㅘ ㅙ ㅚ ㅛ ㅜ ㅝ ㅞ ㅟ ㅠ ㅡ ㅢ ㅣ).freeze
|
21
21
|
JONGSUNGS = %w(ㄱ ㄲ ㄳ ㄴ ㄵ ㄶ ㄷ ㄹ ㄺ ㄻ ㄼ ㄽ ㄾ ㄿ ㅀ ㅁ ㅂ ㅄ ㅅ ㅆ ㅇ ㅈ ㅊ ㅋ ㅌ ㅍ ㅎ).unshift(nil).freeze
|
22
22
|
KR_RANGE = ('가'.unpack('U')[0]..'힣'.unpack('U')[0]).freeze
|
23
23
|
KR_OFFSET = KR_RANGE.first.freeze
|
data/lib/ununiga/josa_picker.rb
CHANGED
@@ -28,7 +28,7 @@ module Ununiga
|
|
28
28
|
if index == 0
|
29
29
|
matched
|
30
30
|
else
|
31
|
-
josa = JOSAS.find { |
|
31
|
+
josa = JOSAS.find { |jo| josa_convension(jo).include? matched }
|
32
32
|
splitter = JasoSplitter.new(korean_str[index - 1])
|
33
33
|
josa[(splitter.jongsung ? 0 : 1)]
|
34
34
|
end
|
data/test/test_jaso_splitter.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'minitest/autorun'
|
2
2
|
require 'ununiga/jaso_splitter'
|
3
3
|
|
4
|
-
class JamoSplitterTest < Minitest::
|
4
|
+
class JamoSplitterTest < Minitest::Test
|
5
5
|
def test_extract_chosung
|
6
6
|
testgroup = { '가' => 'ㄱ',
|
7
7
|
'낳' => 'ㄴ',
|
@@ -18,7 +18,9 @@ class JamoSplitterTest < Minitest::Unit::TestCase
|
|
18
18
|
testgroup = { '가' => 'ㅏ',
|
19
19
|
'내' => 'ㅐ',
|
20
20
|
'찋' => 'ㅢ',
|
21
|
-
'휷' => 'ㅠ'
|
21
|
+
'휷' => 'ㅠ',
|
22
|
+
'쿄' => 'ㅛ',
|
23
|
+
'왜' => 'ㅙ'
|
22
24
|
}
|
23
25
|
testgroup.each do |char, jungsung|
|
24
26
|
splitter = Ununiga::JasoSplitter.new(char)
|
@@ -34,14 +36,19 @@ class JamoSplitterTest < Minitest::Unit::TestCase
|
|
34
36
|
}
|
35
37
|
testgroup.each do |char, jongsung|
|
36
38
|
splitter = Ununiga::JasoSplitter.new(char)
|
37
|
-
|
39
|
+
if jongsung
|
40
|
+
assert_equal jongsung, splitter.extract_jongsung
|
41
|
+
else
|
42
|
+
assert_nil splitter.extract_jongsung
|
43
|
+
end
|
38
44
|
end
|
39
45
|
end
|
40
46
|
|
41
47
|
def test_split
|
42
48
|
testgroup = { '신' => ['ㅅ', 'ㅣ', 'ㄴ'],
|
43
49
|
'재' => ['ㅈ', 'ㅐ', nil],
|
44
|
-
'현' => ['ㅎ', 'ㅕ', 'ㄴ']
|
50
|
+
'현' => ['ㅎ', 'ㅕ', 'ㄴ'],
|
51
|
+
'꾢' => ['ㄲ', 'ㅛ', 'ㄶ']
|
45
52
|
}
|
46
53
|
testgroup.each do |char, splitted|
|
47
54
|
splitter = Ununiga::JasoSplitter.new(char)
|
data/test/test_josa_picker.rb
CHANGED
@@ -2,7 +2,7 @@ require 'minitest/autorun'
|
|
2
2
|
require 'i18n'
|
3
3
|
require 'ununiga/i18n/josa_transformer'
|
4
4
|
|
5
|
-
class JosaTransformerTest < Minitest::
|
5
|
+
class JosaTransformerTest < Minitest::Test
|
6
6
|
def setup
|
7
7
|
super
|
8
8
|
I18n::Backend::Simple.send(:include, Ununiga::I18n::JosaTransformer)
|
data/ununiga.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ununiga
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jaehyun Shin
|
@@ -38,7 +38,7 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
description:
|
41
|
+
description: 한글 자소 분리 및 적절한 조사를 찾아주어 번역해줍니다.
|
42
42
|
email: keepcosmos@gmail.com
|
43
43
|
executables: []
|
44
44
|
extensions: []
|
@@ -48,6 +48,7 @@ files:
|
|
48
48
|
- ".travis.yml"
|
49
49
|
- Gemfile
|
50
50
|
- Gemfile.lock
|
51
|
+
- LICENSE.txt
|
51
52
|
- README.md
|
52
53
|
- Rakefile
|
53
54
|
- lib/ununiga.rb
|
@@ -80,9 +81,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
81
|
version: '0'
|
81
82
|
requirements: []
|
82
83
|
rubyforge_project:
|
83
|
-
rubygems_version: 2.6.
|
84
|
+
rubygems_version: 2.6.11
|
84
85
|
signing_key:
|
85
86
|
specification_version: 4
|
86
87
|
summary: Support Jaso and Josa(Korean Language specific function)
|
87
88
|
test_files: []
|
88
|
-
has_rdoc:
|