rubicure_fuzzy_match 0.1.0
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/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +48 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/rubicure_fuzzy_match/version.rb +3 -0
- data/lib/rubicure_fuzzy_match.rb +33 -0
- data/rubicure_fuzzy_match.gemspec +28 -0
- metadata +126 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 654680e1cc0fe1dc3de779f6c9eee65ff3f153d9
|
4
|
+
data.tar.gz: 0d316b3837d75f0cfbb15bc54354cae44bfc825d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e363e384ae73ca28225b2f53731d481b8f817fe7bab496e9e64ef325b7ea0f09f1a8f25589c6d73dfed749504cb26723ef2ae77cc981b34cb5d138a8e024f5a0
|
7
|
+
data.tar.gz: 4f3db50aaab5fc8530c2c10768852cd17e13af4c7558a8baf071bcbf3edb6712c5545ee133ff1c99326c8959f137c431c08dfc6f6688dff1276c07e535f862d1
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 ka
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# RubicureFuzzyMatch
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/rubicure_fuzzy_match.svg)](http://badge.fury.io/rb/rubicure_fuzzy_match)
|
4
|
+
[![Dependency Status](https://gemnasium.com/kaosf/rubicure_fuzzy_match.svg)](https://gemnasium.com/kaosf/rubicure_fuzzy_match)
|
5
|
+
[![Build Status](https://travis-ci.org/kaosf/rubicure_fuzzy_match.svg)](https://travis-ci.org/kaosf/rubicure_fuzzy_match)
|
6
|
+
[![Code Climate](https://codeclimate.com/github/kaosf/rubicure_fuzzy_match/badges/gpa.svg)](https://codeclimate.com/github/kaosf/rubicure_fuzzy_match)
|
7
|
+
|
8
|
+
```ruby
|
9
|
+
Rubicure::Seriese.regularize 'S☆S' #=> "ふたりはプリキュア Splash☆Star"
|
10
|
+
```
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
x = Rubicure::Seriese.fuzzy_find 'S☆S'
|
14
|
+
x.title #=> "ふたりはプリキュア Splash☆Star"
|
15
|
+
x.class #=> Rubicure::Seriese
|
16
|
+
```
|
17
|
+
|
18
|
+
## Installation
|
19
|
+
|
20
|
+
Add this line to your application's Gemfile:
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
gem 'rubicure_fuzzy_match'
|
24
|
+
```
|
25
|
+
|
26
|
+
And then execute:
|
27
|
+
|
28
|
+
$ bundle
|
29
|
+
|
30
|
+
Or install it yourself as:
|
31
|
+
|
32
|
+
$ gem install rubicure_fuzzy_match
|
33
|
+
|
34
|
+
## Development
|
35
|
+
|
36
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake false` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
37
|
+
|
38
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
39
|
+
|
40
|
+
## Contributing
|
41
|
+
|
42
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rubicure_fuzzy_match.
|
43
|
+
|
44
|
+
## License
|
45
|
+
|
46
|
+
[MIT](http://opensource.org/licenses/MIT)
|
47
|
+
|
48
|
+
Copyright (C) 2015 ka
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "rubicure_fuzzy_match"
|
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,33 @@
|
|
1
|
+
require "rubicure_fuzzy_match/version"
|
2
|
+
require "rubicure"
|
3
|
+
require "fuzzy_match"
|
4
|
+
|
5
|
+
class Rubicure::Seriese
|
6
|
+
TITLES = Precure.map(&:title)
|
7
|
+
TITLES_DICTIONARY = Hash[*TITLES.map.with_index { |e, i| [e, i] }.flatten]
|
8
|
+
FUZZY_TITLES_DICTIONARY = {
|
9
|
+
'初代' => 0,
|
10
|
+
'無印' => 0,
|
11
|
+
'555' => 4,
|
12
|
+
'フレプリ' => 5,
|
13
|
+
'ハト' => 6,
|
14
|
+
'スイプリ' => 7,
|
15
|
+
'スマプリ' => 8,
|
16
|
+
'ドキプリ' => 9,
|
17
|
+
'ドドリア' => 9,
|
18
|
+
'ハチャプリ' => 10,
|
19
|
+
'ゴプリプリ' => 11,
|
20
|
+
'姫プリ' => 11,
|
21
|
+
}
|
22
|
+
FUZZY_MATCHER = FuzzyMatch.new(TITLES + FUZZY_TITLES_DICTIONARY.keys)
|
23
|
+
TITLES_DICTIONARY.merge! FUZZY_TITLES_DICTIONARY
|
24
|
+
|
25
|
+
def self.regularize(title)
|
26
|
+
s = FUZZY_MATCHER.find title
|
27
|
+
s ? TITLES[TITLES_DICTIONARY[s]] : nil
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.fuzzy_find(title)
|
31
|
+
Precure.select { |e| e.title == regularize(title) }.first
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rubicure_fuzzy_match/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "rubicure_fuzzy_match"
|
8
|
+
spec.version = RubicureFuzzyMatch::VERSION
|
9
|
+
spec.authors = ["ka"]
|
10
|
+
spec.email = ["ka.kaosf@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Fuzzy matcher for Rubicure}
|
13
|
+
spec.description = %q{Fuzzy matcher for Rubicure}
|
14
|
+
spec.homepage = "https://github.com/kaosf/rubicure_fuzzy_matcher"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_dependency "rubicure", "0.2.7"
|
23
|
+
spec.add_dependency "fuzzy_match", "~> 2.1.0"
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.10"
|
26
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
+
spec.add_development_dependency "test-unit", "~> 3.1.3"
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rubicure_fuzzy_match
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- ka
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-08-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rubicure
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.2.7
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.2.7
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: fuzzy_match
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.1.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 2.1.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.10'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.10'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: test-unit
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 3.1.3
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 3.1.3
|
83
|
+
description: Fuzzy matcher for Rubicure
|
84
|
+
email:
|
85
|
+
- ka.kaosf@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- ".travis.yml"
|
92
|
+
- Gemfile
|
93
|
+
- LICENSE.txt
|
94
|
+
- README.md
|
95
|
+
- Rakefile
|
96
|
+
- bin/console
|
97
|
+
- bin/setup
|
98
|
+
- lib/rubicure_fuzzy_match.rb
|
99
|
+
- lib/rubicure_fuzzy_match/version.rb
|
100
|
+
- rubicure_fuzzy_match.gemspec
|
101
|
+
homepage: https://github.com/kaosf/rubicure_fuzzy_matcher
|
102
|
+
licenses:
|
103
|
+
- MIT
|
104
|
+
metadata: {}
|
105
|
+
post_install_message:
|
106
|
+
rdoc_options: []
|
107
|
+
require_paths:
|
108
|
+
- lib
|
109
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
requirements: []
|
120
|
+
rubyforge_project:
|
121
|
+
rubygems_version: 2.4.5.1
|
122
|
+
signing_key:
|
123
|
+
specification_version: 4
|
124
|
+
summary: Fuzzy matcher for Rubicure
|
125
|
+
test_files: []
|
126
|
+
has_rdoc:
|