unf_ext 0.0.7.1-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.document +5 -0
- data/.gitignore +19 -0
- data/.travis.yml +18 -0
- data/CHANGELOG.md +20 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +58 -0
- data/Rakefile +20 -0
- data/ext/unf_ext/extconf.rb +30 -0
- data/ext/unf_ext/unf.cc +75 -0
- data/ext/unf_ext/unf/normalizer.hh +139 -0
- data/ext/unf_ext/unf/table.hh +13542 -0
- data/ext/unf_ext/unf/trie/char_stream.hh +150 -0
- data/ext/unf_ext/unf/trie/node.hh +25 -0
- data/ext/unf_ext/unf/trie/searcher.hh +194 -0
- data/ext/unf_ext/unf/util.hh +24 -0
- data/lib/unf_ext.rb +5 -0
- data/lib/unf_ext/version.rb +5 -0
- data/test/helper.rb +18 -0
- data/test/normalization-test.txt +108816 -0
- data/test/test_unf_ext.rb +41 -0
- data/unf_ext.gemspec +38 -0
- metadata +143 -0
@@ -0,0 +1,41 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require 'helper'
|
3
|
+
require 'pathname'
|
4
|
+
|
5
|
+
class TestUnf < Test::Unit::TestCase
|
6
|
+
test "raise ArgumentError if an unknown normalization form is given" do
|
7
|
+
normalizer = UNF::Normalizer.new
|
8
|
+
assert_raises(ArgumentError) { normalizer.normalize("が", :nfck) }
|
9
|
+
end
|
10
|
+
|
11
|
+
test "pass all tests bundled with the original unf" do
|
12
|
+
normalizer = UNF::Normalizer.new
|
13
|
+
open(Pathname(__FILE__).dirname + 'normalization-test.txt', 'r:utf-8').each_slice(6) { |lines|
|
14
|
+
flunk "broken test file" if lines.size != 6 || lines.pop !~ /^$/
|
15
|
+
str, nfd, nfc, nfkd, nfkc = lines
|
16
|
+
assert nfd, normalizer.normalize(str, :nfd)
|
17
|
+
assert nfd, normalizer.normalize(nfd, :nfd)
|
18
|
+
assert nfd, normalizer.normalize(nfc, :nfd)
|
19
|
+
assert nfkd, normalizer.normalize(nfkc, :nfd)
|
20
|
+
assert nfkd, normalizer.normalize(nfkc, :nfd)
|
21
|
+
|
22
|
+
assert nfc, normalizer.normalize(str, :nfd)
|
23
|
+
assert nfc, normalizer.normalize(nfd, :nfc)
|
24
|
+
assert nfc, normalizer.normalize(nfc, :nfc)
|
25
|
+
assert nfkc, normalizer.normalize(nfkc, :nfc)
|
26
|
+
assert nfkc, normalizer.normalize(nfkd, :nfc)
|
27
|
+
|
28
|
+
assert nfkd, normalizer.normalize(str, :nfkd)
|
29
|
+
assert nfkd, normalizer.normalize(nfd, :nfkd)
|
30
|
+
assert nfkd, normalizer.normalize(nfc, :nfkd)
|
31
|
+
assert nfkd, normalizer.normalize(nfkc, :nfkd)
|
32
|
+
assert nfkd, normalizer.normalize(nfkd, :nfkd)
|
33
|
+
|
34
|
+
assert nfkc, normalizer.normalize(str, :nfkc)
|
35
|
+
assert nfkc, normalizer.normalize(nfd, :nfkc)
|
36
|
+
assert nfkc, normalizer.normalize(nfc, :nfkc)
|
37
|
+
assert nfkc, normalizer.normalize(nfkc, :nfkc)
|
38
|
+
assert nfkc, normalizer.normalize(nfkd, :nfkc)
|
39
|
+
}
|
40
|
+
end
|
41
|
+
end
|
data/unf_ext.gemspec
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'unf_ext/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "unf_ext"
|
8
|
+
gem.version = UNF::Normalizer::VERSION
|
9
|
+
gem.authors = ["Takeru Ohta", "Akinori MUSHA"]
|
10
|
+
gem.email = ["knu@idaemons.org"]
|
11
|
+
gem.description = %q{Unicode Normalization Form support library for CRuby}
|
12
|
+
gem.summary = %q{Unicode Normalization Form support library for CRuby}
|
13
|
+
gem.homepage = "https://github.com/knu/ruby-unf_ext"
|
14
|
+
gem.licenses = ["MIT"]
|
15
|
+
|
16
|
+
gem.files = `git ls-files`.split($/)
|
17
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
18
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/}).grep(%r{/test_[^/]+\.rb$})
|
19
|
+
gem.require_paths = ["lib"]
|
20
|
+
gem.extensions = ["ext/unf_ext/extconf.rb"]
|
21
|
+
|
22
|
+
gem.extra_rdoc_files = [
|
23
|
+
"LICENSE.txt",
|
24
|
+
"README.md"
|
25
|
+
]
|
26
|
+
|
27
|
+
if RUBY_VERSION < "1.9"
|
28
|
+
gem.add_development_dependency('i18n', '< 0.7.0')
|
29
|
+
# Cap dependency on activesupport with < 4.0 on behalf of
|
30
|
+
# shoulda-matchers to satisfy bundler.
|
31
|
+
gem.add_development_dependency("activesupport", ["< 4.0"])
|
32
|
+
end
|
33
|
+
gem.add_development_dependency("rake", [">= 0.9.2.2"])
|
34
|
+
gem.add_development_dependency("rdoc", ["> 2.4.2"])
|
35
|
+
gem.add_development_dependency("bundler", [">= 1.2"])
|
36
|
+
gem.add_development_dependency("rake-compiler", [">= 0.7.9"])
|
37
|
+
gem.add_development_dependency 'test-unit'
|
38
|
+
end
|
metadata
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: unf_ext
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.7.1
|
5
|
+
platform: x64-mingw32
|
6
|
+
authors:
|
7
|
+
- Takeru Ohta
|
8
|
+
- Akinori MUSHA
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2015-04-17 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ! '>='
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 0.9.2.2
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ! '>='
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 0.9.2.2
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rdoc
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ! '>'
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 2.4.2
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ! '>'
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 2.4.2
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: bundler
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ! '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '1.2'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '1.2'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rake-compiler
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 0.7.9
|
63
|
+
type: :development
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 0.7.9
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: test-unit
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - ! '>='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
description: Unicode Normalization Form support library for CRuby
|
85
|
+
email:
|
86
|
+
- knu@idaemons.org
|
87
|
+
executables: []
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files:
|
90
|
+
- LICENSE.txt
|
91
|
+
- README.md
|
92
|
+
files:
|
93
|
+
- .document
|
94
|
+
- .gitignore
|
95
|
+
- .travis.yml
|
96
|
+
- CHANGELOG.md
|
97
|
+
- Gemfile
|
98
|
+
- LICENSE.txt
|
99
|
+
- README.md
|
100
|
+
- Rakefile
|
101
|
+
- ext/unf_ext/extconf.rb
|
102
|
+
- ext/unf_ext/unf.cc
|
103
|
+
- ext/unf_ext/unf/normalizer.hh
|
104
|
+
- ext/unf_ext/unf/table.hh
|
105
|
+
- ext/unf_ext/unf/trie/char_stream.hh
|
106
|
+
- ext/unf_ext/unf/trie/node.hh
|
107
|
+
- ext/unf_ext/unf/trie/searcher.hh
|
108
|
+
- ext/unf_ext/unf/util.hh
|
109
|
+
- lib/2.0/unf_ext.so
|
110
|
+
- lib/2.1/unf_ext.so
|
111
|
+
- lib/2.2/unf_ext.so
|
112
|
+
- lib/unf_ext.rb
|
113
|
+
- lib/unf_ext/version.rb
|
114
|
+
- test/helper.rb
|
115
|
+
- test/normalization-test.txt
|
116
|
+
- test/test_unf_ext.rb
|
117
|
+
- unf_ext.gemspec
|
118
|
+
homepage: https://github.com/knu/ruby-unf_ext
|
119
|
+
licenses:
|
120
|
+
- MIT
|
121
|
+
metadata: {}
|
122
|
+
post_install_message:
|
123
|
+
rdoc_options: []
|
124
|
+
require_paths:
|
125
|
+
- lib
|
126
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ! '>='
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - ! '>='
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
requirements: []
|
137
|
+
rubyforge_project:
|
138
|
+
rubygems_version: 2.4.3
|
139
|
+
signing_key:
|
140
|
+
specification_version: 4
|
141
|
+
summary: Unicode Normalization Form support library for CRuby
|
142
|
+
test_files:
|
143
|
+
- test/test_unf_ext.rb
|