amakanize 0.5.3 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +41 -35
- data/LICENSE.txt +1 -1
- data/README.md +25 -17
- data/amakanize.gemspec +9 -10
- data/lib/amakanize/author_name.rb +3 -19
- data/lib/amakanize/author_names.rb +26 -3
- data/lib/amakanize/filterable.rb +40 -0
- data/lib/amakanize/filters/video_position_detection_filter.rb +22 -0
- data/lib/amakanize/filters/video_position_number_conversion_filter.rb +158 -0
- data/lib/amakanize/series_name.rb +2 -18
- data/lib/amakanize/version.rb +1 -1
- data/lib/amakanize/video_position.rb +21 -0
- data/lib/amakanize.rb +4 -0
- metadata +10 -9
- data/.travis.yml +0 -5
- data/bin/console +0 -14
- data/bin/setup +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 426275ccb0772fe3bde1320c987661f2a866e595
|
4
|
+
data.tar.gz: 811b25a7e84aba958189d436a9fdde4f86bf19f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dcaf9a69a83a7821c503bb3604a970022f3f90d1a12cb0ee913bdf80c7d285f3eb6a3acfd8f80c1831f5c27c83ade1393d6b3a8e1674fb7219947ddd1d1fb563
|
7
|
+
data.tar.gz: c37ce03bbc454bf50365730bb72051d92e93843536f290f925238123720cca911724ecd2d67436cb7784dd0c9dd06002054e88baeb3d3837a5d1941a76d45389
|
data/CHANGELOG.md
CHANGED
@@ -1,148 +1,154 @@
|
|
1
|
-
##
|
1
|
+
## 0.6.0
|
2
|
+
|
3
|
+
- Add `Amakanize::VideoPosition`
|
4
|
+
- Rename author name from "r7kamura" to "Ryo Nakamura"
|
5
|
+
- Set required Ruby version to 2.2.2 or higher for ActiveSupport
|
6
|
+
|
7
|
+
## 0.5.3
|
2
8
|
|
3
9
|
- Support weekly magazine format in series detection
|
4
10
|
|
5
|
-
##
|
11
|
+
## 0.5.2
|
6
12
|
|
7
13
|
- Support nested parentheses
|
8
14
|
|
9
|
-
##
|
15
|
+
## 0.5.1
|
10
16
|
|
11
17
|
- Detect アフタヌーン from アフタヌーン 2016年 05 月号
|
12
18
|
|
13
|
-
##
|
19
|
+
## 0.5.0
|
14
20
|
|
15
21
|
- Remove volume number only one time
|
16
22
|
- Normalize continuous spaces
|
17
23
|
|
18
|
-
##
|
24
|
+
## 0.4.9
|
19
25
|
|
20
26
|
- Fix a bug in the brackets normalization logic
|
21
27
|
|
22
|
-
##
|
28
|
+
## 0.4.8
|
23
29
|
|
24
30
|
- Treat カバーデザイン as role name
|
25
31
|
|
26
|
-
##
|
32
|
+
## 0.4.7
|
27
33
|
|
28
34
|
- Support "Buso Renkin, Vol. 5"
|
29
35
|
|
30
|
-
##
|
36
|
+
## 0.4.6
|
31
37
|
|
32
38
|
- Treat (キャラクター原案)ハラカズヒロ as ハラカズヒロ
|
33
39
|
- Normalize 「x! 」 into 「x!」
|
34
40
|
|
35
|
-
##
|
41
|
+
## 0.4.5
|
36
42
|
|
37
43
|
- Support 2016年04月号 for magazines
|
38
44
|
|
39
|
-
##
|
45
|
+
## 0.4.4
|
40
46
|
|
41
47
|
- Support (前) (後) (上) (中) (下)
|
42
48
|
|
43
|
-
##
|
49
|
+
## 0.4.3
|
44
50
|
|
45
51
|
- Support (原作・イラスト)XXX
|
46
52
|
- Support イラスト:XXX
|
47
53
|
|
48
|
-
##
|
54
|
+
## 0.4.2
|
49
55
|
|
50
56
|
- Support #5
|
51
57
|
|
52
|
-
##
|
58
|
+
## 0.4.1
|
53
59
|
|
54
60
|
- Support Vol.3
|
55
61
|
- Support 3 通常版
|
56
62
|
- Support 7.5
|
57
63
|
|
58
|
-
##
|
64
|
+
## 0.4.0
|
59
65
|
|
60
66
|
- Add spaces around brackets except for ending
|
61
67
|
- Treat `―XXX―` as brackets (e.g. To LOVEる―とらぶる―)
|
62
68
|
|
63
|
-
##
|
69
|
+
## 0.3.0
|
64
70
|
|
65
71
|
- Normalize all brackets into round brackets (parentheses)
|
66
72
|
- Removes only trailing brackets
|
67
73
|
|
68
|
-
##
|
74
|
+
## 0.2.2
|
69
75
|
|
70
76
|
- Support volume N
|
71
77
|
|
72
|
-
##
|
78
|
+
## 0.2.1
|
73
79
|
|
74
80
|
- Normalize angle brackets
|
75
81
|
- Remove trailing LvN and Lv.N as volume number
|
76
82
|
- Fix volume number detection pattern
|
77
83
|
|
78
|
-
##
|
84
|
+
## 0.2.0
|
79
85
|
|
80
86
|
- Fix author name separator
|
81
87
|
|
82
|
-
##
|
88
|
+
## 0.1.12
|
83
89
|
|
84
90
|
- Support 第N版
|
85
91
|
|
86
|
-
##
|
92
|
+
## 0.1.11
|
87
93
|
|
88
94
|
- Improve volume detection for アニウッド大通り
|
89
95
|
|
90
|
-
##
|
96
|
+
## 0.1.10
|
91
97
|
|
92
98
|
- Detect obvious volume number in product title
|
93
99
|
|
94
|
-
##
|
100
|
+
## 0.1.9
|
95
101
|
|
96
102
|
- Normalize hyphen with hyphen/minus
|
97
103
|
|
98
|
-
##
|
104
|
+
## 0.1.8
|
99
105
|
|
100
106
|
- Normalize hyphen between alphabets in series name
|
101
107
|
|
102
|
-
##
|
108
|
+
## 0.1.7
|
103
109
|
|
104
110
|
- Remove trailing surrounding hyphens and payload on series name
|
105
111
|
|
106
|
-
##
|
112
|
+
## 0.1.6
|
107
113
|
|
108
114
|
- Remove trailing dash and payload on series name
|
109
115
|
|
110
|
-
##
|
116
|
+
## 0.1.5
|
111
117
|
|
112
118
|
- Remove spaces between exclamations for 「ばくおん! !」
|
113
119
|
|
114
|
-
##
|
120
|
+
## 0.1.4
|
115
121
|
|
116
122
|
- Add more author name separator
|
117
123
|
- Remove suffix role name
|
118
124
|
|
119
|
-
##
|
125
|
+
## 0.1.3
|
120
126
|
|
121
127
|
- Remove trailing 原作・原案・漫画 of author name
|
122
128
|
|
123
|
-
##
|
129
|
+
## 0.1.2
|
124
130
|
|
125
131
|
- Add AuthorNames class
|
126
132
|
|
127
|
-
##
|
133
|
+
## 0.1.1
|
128
134
|
|
129
135
|
- Support x and X as roman numeric
|
130
136
|
|
131
|
-
##
|
137
|
+
## 0.1.0
|
132
138
|
|
133
139
|
- Support roman numerals on series name
|
134
140
|
- Support 第N巻 on series name
|
135
141
|
- Normalize series name
|
136
142
|
|
137
|
-
##
|
143
|
+
## 0.0.4
|
138
144
|
|
139
145
|
- Normalize all characters
|
140
146
|
|
141
|
-
##
|
147
|
+
## 0.0.3
|
142
148
|
|
143
149
|
- Remove space from author name
|
144
150
|
|
145
|
-
##
|
151
|
+
## 0.0.2
|
146
152
|
|
147
153
|
- Remove parentheses of numericals in author name
|
148
154
|
- Remove role name from author name
|
@@ -150,6 +156,6 @@
|
|
150
156
|
- Strip author name
|
151
157
|
- Unescape HTML in author name
|
152
158
|
|
153
|
-
##
|
159
|
+
## 0.0.1
|
154
160
|
|
155
161
|
- 1st release :tada:
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,24 +1,14 @@
|
|
1
|
-
# Amakanize
|
1
|
+
# Amakanize
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
[![CircleCI](https://img.shields.io/circleci/project/github/amakan/amakanize.svg)](https://circleci.com/gh/amakan/amakanize)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/amakanize.svg)](https://rubygems.org/gems/amakanize)
|
5
|
+
[![Documentation](http://img.shields.io/badge/docs-rdoc.info-blue.svg)](http://www.rubydoc.info/github/amakan/amakanize)
|
6
6
|
|
7
|
-
|
8
|
-
require "amakanize"
|
9
|
-
|
10
|
-
Amakanize::AuthorName.new("ぽんかん(8)").to_s #=> "ぽんかん8"
|
11
|
-
Amakanize::AuthorName.new("ぽんかん8").to_s #=> "ぽんかん8"
|
12
|
-
Amakanize::AuthorName.new("ぽんかん⑧").to_s #=> "ぽんかん8"
|
7
|
+
Utilities to canonicalize series names and author names for [amakan.net](https://amakan.net/).
|
13
8
|
|
14
|
-
|
15
|
-
Amakanize::AuthorNames.new("ぽんかん⑧,渡 航").map(&:to_s) #=> ["ぽんかん8", "渡航"]
|
16
|
-
Amakanize::AuthorNames.new("ぽんかん⑧、渡 航").map(&:to_s) #=> ["ぽんかん8", "渡航"]
|
9
|
+
## Requirements
|
17
10
|
|
18
|
-
|
19
|
-
Amakanize::SeriesName.new("ラブライブ! School idol diary ~星空凛~").to_s #=> "ラブライブ! School idol diary"
|
20
|
-
Amakanize::SeriesName.new("僕だけがいない街 (1) (カドカワコミックス・エース)").to_s #=> "僕だけがいない街"
|
21
|
-
```
|
11
|
+
- Ruby 2.2.2 or higher
|
22
12
|
|
23
13
|
## Installation
|
24
14
|
|
@@ -39,3 +29,21 @@ Or manually install:
|
|
39
29
|
```sh
|
40
30
|
gem install amakanize
|
41
31
|
```
|
32
|
+
|
33
|
+
## Usage
|
34
|
+
|
35
|
+
```rb
|
36
|
+
require "amakanize"
|
37
|
+
|
38
|
+
Amakanize::AuthorName.new("ぽんかん(8)").to_s #=> "ぽんかん8"
|
39
|
+
Amakanize::AuthorName.new("ぽんかん8").to_s #=> "ぽんかん8"
|
40
|
+
Amakanize::AuthorName.new("ぽんかん⑧").to_s #=> "ぽんかん8"
|
41
|
+
|
42
|
+
Amakanize::AuthorNames.new("ぽんかん⑧,渡 航").map(&:to_s) #=> ["ぽんかん8", "渡航"]
|
43
|
+
Amakanize::AuthorNames.new("ぽんかん⑧,渡 航").map(&:to_s) #=> ["ぽんかん8", "渡航"]
|
44
|
+
Amakanize::AuthorNames.new("ぽんかん⑧、渡 航").map(&:to_s) #=> ["ぽんかん8", "渡航"]
|
45
|
+
|
46
|
+
Amakanize::SeriesName.new("やはり俺の青春ラブコメはまちがっている。4").to_s #=> "やはり俺の青春ラブコメはまちがっている。"
|
47
|
+
Amakanize::SeriesName.new("ラブライブ! School idol diary ~星空凛~").to_s #=> "ラブライブ! School idol diary"
|
48
|
+
Amakanize::SeriesName.new("僕だけがいない街 (1) (カドカワコミックス・エース)").to_s #=> "僕だけがいない街"
|
49
|
+
```
|
data/amakanize.gemspec
CHANGED
@@ -3,18 +3,17 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
3
|
require "amakanize/version"
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
|
-
spec.name
|
7
|
-
spec.version
|
8
|
-
spec.authors
|
9
|
-
spec.email
|
10
|
-
spec.summary
|
11
|
-
spec.homepage
|
12
|
-
spec.license
|
6
|
+
spec.name = "amakanize"
|
7
|
+
spec.version = Amakanize::VERSION
|
8
|
+
spec.authors = ["Ryo Nakamura"]
|
9
|
+
spec.email = ["r7kamura@gmail.com"]
|
10
|
+
spec.summary = "Utilities to canonicalize series names and author names."
|
11
|
+
spec.homepage = "https://github.com/amakan/amakanize"
|
12
|
+
spec.license = "MIT"
|
13
13
|
|
14
|
-
spec.files
|
15
|
-
spec.bindir = "exe"
|
16
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
14
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
15
|
spec.require_paths = ["lib"]
|
16
|
+
spec.required_ruby_version = ">= 2.2.2"
|
18
17
|
|
19
18
|
spec.add_dependency "activesupport"
|
20
19
|
spec.add_development_dependency "bundler"
|
@@ -1,7 +1,9 @@
|
|
1
1
|
module Amakanize
|
2
2
|
class AuthorName
|
3
|
+
include ::Amakanize::Filterable
|
4
|
+
|
3
5
|
class << self
|
4
|
-
# @
|
6
|
+
# @note Override
|
5
7
|
def filter_classes
|
6
8
|
@filter_classes ||= [
|
7
9
|
::Amakanize::Filters::HtmlUnescapeFilter,
|
@@ -14,23 +16,5 @@ module Amakanize
|
|
14
16
|
]
|
15
17
|
end
|
16
18
|
end
|
17
|
-
|
18
|
-
# @param raw [String]
|
19
|
-
def initialize(raw)
|
20
|
-
@raw = raw
|
21
|
-
end
|
22
|
-
|
23
|
-
# @note Override
|
24
|
-
def to_s
|
25
|
-
filters.inject(context: {}, output: @raw) do |result, filter|
|
26
|
-
filter.call(result)
|
27
|
-
end[:output]
|
28
|
-
end
|
29
|
-
|
30
|
-
private
|
31
|
-
|
32
|
-
def filters
|
33
|
-
@filters ||= self.class.filter_classes.map(&:new)
|
34
|
-
end
|
35
19
|
end
|
36
20
|
end
|
@@ -8,15 +8,38 @@ module Amakanize
|
|
8
8
|
、
|
9
9
|
)
|
10
10
|
|
11
|
+
AUTHOR_NAME_SEPARATORS_REGEXP = ::Regexp.union(AUTHOR_NAME_SEPARATORS)
|
12
|
+
|
11
13
|
# @param raw [String]
|
12
14
|
def initialize(raw)
|
13
15
|
@raw = raw
|
14
16
|
end
|
15
17
|
|
18
|
+
# @note Implementation for Enumerable
|
16
19
|
def each(&block)
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
+
author_names.each(&block)
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
# @private
|
26
|
+
# @return [Array<Amakanize::AuthorName>]
|
27
|
+
def author_names
|
28
|
+
segments.map do |segment|
|
29
|
+
::Amakanize::AuthorName.new(segment)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# @private
|
34
|
+
# @return [String]
|
35
|
+
def raw
|
36
|
+
@raw
|
37
|
+
end
|
38
|
+
|
39
|
+
# @private
|
40
|
+
# @return [Array<String>]
|
41
|
+
def segments
|
42
|
+
raw.split(AUTHOR_NAME_SEPARATORS_REGEXP)
|
20
43
|
end
|
21
44
|
end
|
22
45
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require "active_support/concern"
|
2
|
+
|
3
|
+
module Amakanize
|
4
|
+
module Filterable
|
5
|
+
extend ::ActiveSupport::Concern
|
6
|
+
|
7
|
+
# @param raw [String]
|
8
|
+
def initialize(raw)
|
9
|
+
@raw = raw
|
10
|
+
end
|
11
|
+
|
12
|
+
# @note Override
|
13
|
+
def to_s
|
14
|
+
filters.inject(context: {}, output: raw) do |result, filter|
|
15
|
+
filter.call(result)
|
16
|
+
end[:output]
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
# @private
|
22
|
+
# @return [Array<Amakanize::Filters::BaseFilter>]
|
23
|
+
def filters
|
24
|
+
@filters ||= self.class.filter_classes.map(&:new)
|
25
|
+
end
|
26
|
+
|
27
|
+
# @private
|
28
|
+
# @return [String]
|
29
|
+
def raw
|
30
|
+
@raw
|
31
|
+
end
|
32
|
+
|
33
|
+
module ClassMethods
|
34
|
+
# @return [Array<Class>]
|
35
|
+
def filter_classes
|
36
|
+
raise ::NotImplementedError
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Amakanize
|
2
|
+
module Filters
|
3
|
+
class VideoPositionDetectionFilter < BaseFilter
|
4
|
+
# @note Override
|
5
|
+
# @param output [String] e.g. `"第1話「でじこだにょ」/第2話「ぷちこと一緒かにょ?」"`
|
6
|
+
# @return [Hash] e.g. `"1"`
|
7
|
+
def call(context:, output:)
|
8
|
+
output = begin
|
9
|
+
if output.match(/#{::Amakanize::PATTERN_OF_VOLUME_PREFIX}(#{PATTERN_OF_NUMERIC_CHARACTERS})/)
|
10
|
+
::Regexp.last_match(1)
|
11
|
+
else
|
12
|
+
""
|
13
|
+
end
|
14
|
+
end
|
15
|
+
{
|
16
|
+
context: context,
|
17
|
+
output: output,
|
18
|
+
}
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,158 @@
|
|
1
|
+
module Amakanize
|
2
|
+
module Filters
|
3
|
+
class VideoPositionNumberConversionFilter < BaseFilter
|
4
|
+
TABLE = {
|
5
|
+
/i/i => 1,
|
6
|
+
/ii/i => 2,
|
7
|
+
/iii/i => 3,
|
8
|
+
/iv/i => 4,
|
9
|
+
/v/i => 5,
|
10
|
+
/vi/i => 6,
|
11
|
+
/vii/i => 7,
|
12
|
+
/viii/i => 8,
|
13
|
+
/ix/i => 9,
|
14
|
+
/x/i => 10,
|
15
|
+
/xi/i => 11,
|
16
|
+
/xii/i => 12,
|
17
|
+
/xiii/i => 13,
|
18
|
+
/xiv/i => 14,
|
19
|
+
/xv/i => 15,
|
20
|
+
/xvi/i => 16,
|
21
|
+
/xvii/i => 17,
|
22
|
+
/xviii/i => 18,
|
23
|
+
/xix/i => 19,
|
24
|
+
/xx/i => 20,
|
25
|
+
/xxi/i => 21,
|
26
|
+
/xxii/i => 22,
|
27
|
+
/xxiii/i => 23,
|
28
|
+
/xxiv/i => 24,
|
29
|
+
/xxv/i => 25,
|
30
|
+
/xxvi/i => 26,
|
31
|
+
/xxvii/i => 27,
|
32
|
+
/xxviii/i => 28,
|
33
|
+
/xxix/i => 29,
|
34
|
+
/xxx/i => 30,
|
35
|
+
/一/ => 1,
|
36
|
+
/二/ => 2,
|
37
|
+
/三/ => 3,
|
38
|
+
/四/ => 4,
|
39
|
+
/五/ => 5,
|
40
|
+
/六/ => 6,
|
41
|
+
/七/ => 7,
|
42
|
+
/八/ => 8,
|
43
|
+
/九/ => 9,
|
44
|
+
/十/ => 10,
|
45
|
+
/十一/ => 11,
|
46
|
+
/十二/ => 12,
|
47
|
+
/十三/ => 13,
|
48
|
+
/十四/ => 14,
|
49
|
+
/十五/ => 15,
|
50
|
+
/十六/ => 16,
|
51
|
+
/十七/ => 17,
|
52
|
+
/十八/ => 18,
|
53
|
+
/十九/ => 19,
|
54
|
+
/二十/ => 20,
|
55
|
+
/二十一/ => 21,
|
56
|
+
/二十二/ => 22,
|
57
|
+
/二十三/ => 23,
|
58
|
+
/二十四/ => 24,
|
59
|
+
/二十五/ => 25,
|
60
|
+
/二十六/ => 26,
|
61
|
+
/二十七/ => 27,
|
62
|
+
/二十八/ => 28,
|
63
|
+
/二十九/ => 29,
|
64
|
+
/三十/ => 30,
|
65
|
+
/三十一/ => 31,
|
66
|
+
/三十二/ => 32,
|
67
|
+
/三十三/ => 33,
|
68
|
+
/三十四/ => 34,
|
69
|
+
/三十五/ => 35,
|
70
|
+
/三十六/ => 36,
|
71
|
+
/三十七/ => 37,
|
72
|
+
/三十八/ => 38,
|
73
|
+
/三十九/ => 39,
|
74
|
+
/四十/ => 40,
|
75
|
+
/四十一/ => 41,
|
76
|
+
/四十二/ => 42,
|
77
|
+
/四十三/ => 43,
|
78
|
+
/四十四/ => 44,
|
79
|
+
/四十五/ => 45,
|
80
|
+
/四十六/ => 46,
|
81
|
+
/四十七/ => 47,
|
82
|
+
/四十八/ => 48,
|
83
|
+
/四十九/ => 49,
|
84
|
+
/五十/ => 50,
|
85
|
+
/五十一/ => 51,
|
86
|
+
/五十二/ => 52,
|
87
|
+
/五十三/ => 53,
|
88
|
+
/五十四/ => 54,
|
89
|
+
/五十五/ => 55,
|
90
|
+
/五十六/ => 56,
|
91
|
+
/五十七/ => 57,
|
92
|
+
/五十八/ => 58,
|
93
|
+
/五十九/ => 59,
|
94
|
+
/六十/ => 60,
|
95
|
+
/六十一/ => 61,
|
96
|
+
/六十二/ => 62,
|
97
|
+
/六十三/ => 63,
|
98
|
+
/六十四/ => 64,
|
99
|
+
/六十五/ => 65,
|
100
|
+
/六十六/ => 66,
|
101
|
+
/六十七/ => 67,
|
102
|
+
/六十八/ => 68,
|
103
|
+
/六十九/ => 69,
|
104
|
+
/七十/ => 70,
|
105
|
+
/七十一/ => 71,
|
106
|
+
/七十二/ => 72,
|
107
|
+
/七十三/ => 73,
|
108
|
+
/七十四/ => 74,
|
109
|
+
/七十五/ => 75,
|
110
|
+
/七十六/ => 76,
|
111
|
+
/七十七/ => 77,
|
112
|
+
/七十八/ => 78,
|
113
|
+
/七十九/ => 79,
|
114
|
+
/八十/ => 80,
|
115
|
+
/八十一/ => 81,
|
116
|
+
/八十二/ => 82,
|
117
|
+
/八十三/ => 83,
|
118
|
+
/八十四/ => 84,
|
119
|
+
/八十五/ => 85,
|
120
|
+
/八十六/ => 86,
|
121
|
+
/八十七/ => 87,
|
122
|
+
/八十八/ => 88,
|
123
|
+
/八十九/ => 89,
|
124
|
+
/九十/ => 90,
|
125
|
+
/九十一/ => 91,
|
126
|
+
/九十二/ => 92,
|
127
|
+
/九十三/ => 93,
|
128
|
+
/九十四/ => 94,
|
129
|
+
/九十五/ => 95,
|
130
|
+
/九十六/ => 96,
|
131
|
+
/九十七/ => 97,
|
132
|
+
/九十八/ => 98,
|
133
|
+
/九十九/ => 99,
|
134
|
+
/①/ => 1,
|
135
|
+
/②/ => 2,
|
136
|
+
/③/ => 3,
|
137
|
+
/④/ => 4,
|
138
|
+
/⑤/ => 5,
|
139
|
+
/⑥/ => 6,
|
140
|
+
/⑦/ => 7,
|
141
|
+
/⑧/ => 8,
|
142
|
+
/⑨/ => 9,
|
143
|
+
/⑩/ => 10,
|
144
|
+
}
|
145
|
+
|
146
|
+
# @note Override
|
147
|
+
def call(context:, output:)
|
148
|
+
output = TABLE.to_a.reverse.each_with_object(output.clone) do |(key, value), result|
|
149
|
+
result.gsub!(key, value.to_s)
|
150
|
+
end
|
151
|
+
{
|
152
|
+
context: context,
|
153
|
+
output: output,
|
154
|
+
}
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module Amakanize
|
2
2
|
class SeriesName
|
3
|
+
include ::Amakanize::Filterable
|
4
|
+
|
3
5
|
class << self
|
4
6
|
# @return [Array<Class>]
|
5
7
|
def filter_classes
|
@@ -22,23 +24,5 @@ module Amakanize
|
|
22
24
|
]
|
23
25
|
end
|
24
26
|
end
|
25
|
-
|
26
|
-
# @param raw [String]
|
27
|
-
def initialize(raw)
|
28
|
-
@raw = raw
|
29
|
-
end
|
30
|
-
|
31
|
-
# @note Override
|
32
|
-
def to_s
|
33
|
-
filters.inject(context: {}, output: @raw) do |result, filter|
|
34
|
-
filter.call(result)
|
35
|
-
end[:output]
|
36
|
-
end
|
37
|
-
|
38
|
-
private
|
39
|
-
|
40
|
-
def filters
|
41
|
-
@filters ||= self.class.filter_classes.map(&:new)
|
42
|
-
end
|
43
27
|
end
|
44
28
|
end
|
data/lib/amakanize/version.rb
CHANGED
@@ -0,0 +1,21 @@
|
|
1
|
+
module Amakanize
|
2
|
+
class VideoPosition
|
3
|
+
include ::Amakanize::Filterable
|
4
|
+
|
5
|
+
class << self
|
6
|
+
# @return [Array<Class>]
|
7
|
+
def filter_classes
|
8
|
+
@filter_classes ||= [
|
9
|
+
::Amakanize::Filters::HtmlUnescapeFilter,
|
10
|
+
::Amakanize::Filters::NormalizationFilter,
|
11
|
+
::Amakanize::Filters::ContinuousSpacesNormalizationFilter,
|
12
|
+
::Amakanize::Filters::HyphenMinusNormalizationFilter,
|
13
|
+
::Amakanize::Filters::DashBetweenAlhabetsNormalizationFilter,
|
14
|
+
::Amakanize::Filters::BracketsNormalizationFilter,
|
15
|
+
::Amakanize::Filters::VideoPositionDetectionFilter,
|
16
|
+
::Amakanize::Filters::VideoPositionNumberConversionFilter,
|
17
|
+
]
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/amakanize.rb
CHANGED
@@ -34,6 +34,7 @@ module Amakanize
|
|
34
34
|
/x
|
35
35
|
end
|
36
36
|
|
37
|
+
require "amakanize/filterable"
|
37
38
|
require "amakanize/author_name"
|
38
39
|
require "amakanize/author_names"
|
39
40
|
require "amakanize/filters/base_filter"
|
@@ -56,5 +57,8 @@ require "amakanize/filters/trailing_double_parentheses_singlization_filter"
|
|
56
57
|
require "amakanize/filters/trailing_parentheses_deletion_filter"
|
57
58
|
require "amakanize/filters/trailing_series_name_payload_deletion_filter"
|
58
59
|
require "amakanize/filters/trailing_volume_number_deletion_filter"
|
60
|
+
require "amakanize/filters/video_position_detection_filter"
|
61
|
+
require "amakanize/filters/video_position_number_conversion_filter"
|
59
62
|
require "amakanize/series_name"
|
60
63
|
require "amakanize/version"
|
64
|
+
require "amakanize/video_position"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amakanize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Ryo Nakamura
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -90,18 +90,16 @@ files:
|
|
90
90
|
- ".gitignore"
|
91
91
|
- ".rspec"
|
92
92
|
- ".rubocop.yml"
|
93
|
-
- ".travis.yml"
|
94
93
|
- CHANGELOG.md
|
95
94
|
- Gemfile
|
96
95
|
- LICENSE.txt
|
97
96
|
- README.md
|
98
97
|
- Rakefile
|
99
98
|
- amakanize.gemspec
|
100
|
-
- bin/console
|
101
|
-
- bin/setup
|
102
99
|
- lib/amakanize.rb
|
103
100
|
- lib/amakanize/author_name.rb
|
104
101
|
- lib/amakanize/author_names.rb
|
102
|
+
- lib/amakanize/filterable.rb
|
105
103
|
- lib/amakanize/filters/base_filter.rb
|
106
104
|
- lib/amakanize/filters/brackets_normalization_filter.rb
|
107
105
|
- lib/amakanize/filters/continuous_spaces_normalization_filter.rb
|
@@ -122,8 +120,11 @@ files:
|
|
122
120
|
- lib/amakanize/filters/trailing_parentheses_deletion_filter.rb
|
123
121
|
- lib/amakanize/filters/trailing_series_name_payload_deletion_filter.rb
|
124
122
|
- lib/amakanize/filters/trailing_volume_number_deletion_filter.rb
|
123
|
+
- lib/amakanize/filters/video_position_detection_filter.rb
|
124
|
+
- lib/amakanize/filters/video_position_number_conversion_filter.rb
|
125
125
|
- lib/amakanize/series_name.rb
|
126
126
|
- lib/amakanize/version.rb
|
127
|
+
- lib/amakanize/video_position.rb
|
127
128
|
homepage: https://github.com/amakan/amakanize
|
128
129
|
licenses:
|
129
130
|
- MIT
|
@@ -136,7 +137,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
136
137
|
requirements:
|
137
138
|
- - ">="
|
138
139
|
- !ruby/object:Gem::Version
|
139
|
-
version:
|
140
|
+
version: 2.2.2
|
140
141
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
142
|
requirements:
|
142
143
|
- - ">="
|
@@ -144,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
144
145
|
version: '0'
|
145
146
|
requirements: []
|
146
147
|
rubyforge_project:
|
147
|
-
rubygems_version: 2.
|
148
|
+
rubygems_version: 2.5.2
|
148
149
|
signing_key:
|
149
150
|
specification_version: 4
|
150
151
|
summary: Utilities to canonicalize series names and author names.
|
data/.travis.yml
DELETED
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
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
|