amakanize 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/CHANGELOG.md +2 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +21 -0
- data/Rakefile +5 -0
- data/amakanize.gemspec +23 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/amakanize/author_name.rb +187 -0
- data/lib/amakanize/series_name.rb +19 -0
- data/lib/amakanize/version.rb +3 -0
- data/lib/amakanize.rb +3 -0
- metadata +116 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d592c1c44897590e526b7d614c8aed78e6ea5d0a
|
4
|
+
data.tar.gz: 84063288b8a6901ea667eed70e9235ccf1263ccd
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7fa3c2bb7591740afd09647ceb35c115c7cbe6a92c9d9c294549f1b8939d8106dee96b5db2ac2eb16909c09a76d9f7a8fa20fa5bbf68e80a53a7e7d179d1e27a
|
7
|
+
data.tar.gz: d955844fa450b730ce4d47f45ab89e35675a031cfa2cd60f35a25ce013020445f64e9052b3e223754e761f2d4e5b5ff0fd1fe18e92ac1b1ab3cb110ccd68307b
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 r7kamura
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# Amakanize [![Build Status](https://travis-ci.org/amakan/amakanize.svg?branch=master)](https://travis-ci.org/amakan/amakanize)
|
2
|
+
|
3
|
+
Utilities to canonicalize book titles and author names.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem "amakanize"
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
```sh
|
16
|
+
bundle
|
17
|
+
```
|
18
|
+
|
19
|
+
```sh
|
20
|
+
gem install amakanize
|
21
|
+
```
|
data/Rakefile
ADDED
data/amakanize.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "amakanize/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "amakanize"
|
7
|
+
spec.version = Amakanize::VERSION
|
8
|
+
spec.authors = ["r7kamura"]
|
9
|
+
spec.email = ["r7kamura@gmail.com"]
|
10
|
+
spec.summary = "Utilities to canonicalize book titles and author names."
|
11
|
+
spec.homepage = "https://github.com/amakan/amakanize"
|
12
|
+
spec.license = "MIT"
|
13
|
+
|
14
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
15
|
+
spec.bindir = "exe"
|
16
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
17
|
+
spec.require_paths = ["lib"]
|
18
|
+
|
19
|
+
spec.add_dependency "activesupport"
|
20
|
+
spec.add_development_dependency "bundler"
|
21
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
22
|
+
spec.add_development_dependency "rspec", "3.5.0"
|
23
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "amakanize"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,187 @@
|
|
1
|
+
require "active_support"
|
2
|
+
|
3
|
+
module Amakanize
|
4
|
+
class AuthorName
|
5
|
+
ENCLOSED_ALPHANUMERICS = %w(
|
6
|
+
⓿
|
7
|
+
⓪
|
8
|
+
➀
|
9
|
+
➊
|
10
|
+
➀
|
11
|
+
❶
|
12
|
+
①
|
13
|
+
⓵
|
14
|
+
⓾
|
15
|
+
➉
|
16
|
+
❿
|
17
|
+
➉
|
18
|
+
➓
|
19
|
+
⑩
|
20
|
+
⓫
|
21
|
+
⑪
|
22
|
+
⓬
|
23
|
+
⑫
|
24
|
+
⑬
|
25
|
+
⓭
|
26
|
+
⑭
|
27
|
+
⓮
|
28
|
+
⑮
|
29
|
+
⓯
|
30
|
+
⑯
|
31
|
+
⓰
|
32
|
+
⓱
|
33
|
+
⑰
|
34
|
+
⓲
|
35
|
+
⑱
|
36
|
+
⑲
|
37
|
+
⓳
|
38
|
+
❷
|
39
|
+
⓶
|
40
|
+
②
|
41
|
+
➁
|
42
|
+
➋
|
43
|
+
➁
|
44
|
+
⓴
|
45
|
+
⑳
|
46
|
+
㉑
|
47
|
+
㉒
|
48
|
+
㉓
|
49
|
+
㉔
|
50
|
+
㉕
|
51
|
+
㉖
|
52
|
+
㉗
|
53
|
+
㉘
|
54
|
+
㉙
|
55
|
+
➌
|
56
|
+
➂
|
57
|
+
⓷
|
58
|
+
❸
|
59
|
+
③
|
60
|
+
➂
|
61
|
+
㉚
|
62
|
+
㉛
|
63
|
+
㉜
|
64
|
+
㉝
|
65
|
+
㉞
|
66
|
+
㉟
|
67
|
+
㊱
|
68
|
+
㊲
|
69
|
+
㊳
|
70
|
+
㊴
|
71
|
+
➃
|
72
|
+
➍
|
73
|
+
⓸
|
74
|
+
④
|
75
|
+
❹
|
76
|
+
➃
|
77
|
+
㊵
|
78
|
+
㊶
|
79
|
+
㊷
|
80
|
+
㊸
|
81
|
+
㊹
|
82
|
+
㊺
|
83
|
+
㊻
|
84
|
+
㊼
|
85
|
+
㊽
|
86
|
+
㊾
|
87
|
+
⑤
|
88
|
+
⓹
|
89
|
+
➄
|
90
|
+
➄
|
91
|
+
❺
|
92
|
+
➎
|
93
|
+
㊿
|
94
|
+
⑥
|
95
|
+
➅
|
96
|
+
❻
|
97
|
+
➏
|
98
|
+
⓺
|
99
|
+
➅
|
100
|
+
➆
|
101
|
+
⑦
|
102
|
+
➐
|
103
|
+
⓻
|
104
|
+
➆
|
105
|
+
❼
|
106
|
+
⑧
|
107
|
+
➇
|
108
|
+
➇
|
109
|
+
❽
|
110
|
+
⓼
|
111
|
+
➑
|
112
|
+
❾
|
113
|
+
⑨
|
114
|
+
➈
|
115
|
+
⓽
|
116
|
+
➒
|
117
|
+
➈
|
118
|
+
ⓐ
|
119
|
+
Ⓐ
|
120
|
+
ⓑ
|
121
|
+
Ⓑ
|
122
|
+
ⓒ
|
123
|
+
Ⓒ
|
124
|
+
ⓓ
|
125
|
+
Ⓓ
|
126
|
+
ⓔ
|
127
|
+
Ⓔ
|
128
|
+
ⓕ
|
129
|
+
Ⓕ
|
130
|
+
ⓖ
|
131
|
+
Ⓖ
|
132
|
+
ⓗ
|
133
|
+
Ⓗ
|
134
|
+
ⓘ
|
135
|
+
Ⓘ
|
136
|
+
ⓙ
|
137
|
+
Ⓙ
|
138
|
+
ⓚ
|
139
|
+
Ⓚ
|
140
|
+
ⓛ
|
141
|
+
Ⓛ
|
142
|
+
ⓜ
|
143
|
+
Ⓜ
|
144
|
+
ⓝ
|
145
|
+
Ⓝ
|
146
|
+
ⓞ
|
147
|
+
Ⓞ
|
148
|
+
ⓟ
|
149
|
+
Ⓟ
|
150
|
+
ⓠ
|
151
|
+
Ⓠ
|
152
|
+
ⓡ
|
153
|
+
Ⓡ
|
154
|
+
ⓢ
|
155
|
+
Ⓢ
|
156
|
+
ⓣ
|
157
|
+
Ⓣ
|
158
|
+
ⓤ
|
159
|
+
Ⓤ
|
160
|
+
ⓥ
|
161
|
+
Ⓥ
|
162
|
+
ⓦ
|
163
|
+
Ⓦ
|
164
|
+
ⓧ
|
165
|
+
Ⓧ
|
166
|
+
ⓨ
|
167
|
+
Ⓨ
|
168
|
+
ⓩ
|
169
|
+
Ⓩ
|
170
|
+
)
|
171
|
+
|
172
|
+
# @param raw [String]
|
173
|
+
def initialize(raw)
|
174
|
+
@raw = raw
|
175
|
+
end
|
176
|
+
|
177
|
+
# @note Override
|
178
|
+
def to_s
|
179
|
+
ENCLOSED_ALPHANUMERICS.inject(@raw) do |result, enclosed_alphanumerics|
|
180
|
+
result.gsub(enclosed_alphanumerics) do |matched_string|
|
181
|
+
half_size_alphanumerics = ::ActiveSupport::Multibyte::Unicode.normalize(matched_string)
|
182
|
+
"(#{half_size_alphanumerics})"
|
183
|
+
end
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Amakanize
|
2
|
+
class SeriesName
|
3
|
+
# @param raw [String]
|
4
|
+
def initialize(raw)
|
5
|
+
@raw = raw
|
6
|
+
end
|
7
|
+
|
8
|
+
# @note Override
|
9
|
+
def to_s
|
10
|
+
@raw
|
11
|
+
.gsub(/[[:space:]]*[\((〈《【「『【[\[〔{\{«‹〘〚].*/, "")
|
12
|
+
.gsub(/[[:space:]]*通常版/, "")
|
13
|
+
.gsub(/[[:space:]]+[1-9\d①②③④⑤⑥⑦⑧⑨⑩].*/, "")
|
14
|
+
.gsub(/[[:space:]]*[1-9\d①②③④⑤⑥⑦⑧⑨⑩]+巻?\z/, "")
|
15
|
+
.gsub(/[[:space:]]*~.+~/, "")
|
16
|
+
.gsub(/\A[[:space:]]+|[[:space:]]+\z/, "")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/lib/amakanize.rb
ADDED
metadata
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: amakanize
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- r7kamura
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-07-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.5.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 3.5.0
|
69
|
+
description:
|
70
|
+
email:
|
71
|
+
- r7kamura@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rspec"
|
78
|
+
- ".travis.yml"
|
79
|
+
- CHANGELOG.md
|
80
|
+
- Gemfile
|
81
|
+
- LICENSE.txt
|
82
|
+
- README.md
|
83
|
+
- Rakefile
|
84
|
+
- amakanize.gemspec
|
85
|
+
- bin/console
|
86
|
+
- bin/setup
|
87
|
+
- lib/amakanize.rb
|
88
|
+
- lib/amakanize/author_name.rb
|
89
|
+
- lib/amakanize/series_name.rb
|
90
|
+
- lib/amakanize/version.rb
|
91
|
+
homepage: https://github.com/amakan/amakanize
|
92
|
+
licenses:
|
93
|
+
- MIT
|
94
|
+
metadata: {}
|
95
|
+
post_install_message:
|
96
|
+
rdoc_options: []
|
97
|
+
require_paths:
|
98
|
+
- lib
|
99
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
requirements: []
|
110
|
+
rubyforge_project:
|
111
|
+
rubygems_version: 2.4.5
|
112
|
+
signing_key:
|
113
|
+
specification_version: 4
|
114
|
+
summary: Utilities to canonicalize book titles and author names.
|
115
|
+
test_files: []
|
116
|
+
has_rdoc:
|