word_scoop 2.1.1 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +16 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/LICENSE.txt +21 -0
- data/README.md +2 -0
- data/ext/word_scoop/word_scoop.c +2 -2
- data/lib/word_scoop/version.rb +1 -1
- data/word_scoop.gemspec +8 -6
- metadata +27 -22
- data/spec/spec_helper.rb +0 -2
- data/spec/unit/word_scoop_spec.rb +0 -28
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 291006365ae144ad29803e1e9e0396f0e1ba72e9
|
4
|
+
data.tar.gz: 8f50d37002eac9065ca0b65384f9cf3371577841
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a4b9d9be7f7e0f0ad8f24d2fd006654d058e6c9247678c9c0abcbabdeb011307391ca1331832a937bcddb93d01dce048619b49d8c453125d7c9e2871863ea48
|
7
|
+
data.tar.gz: b1d3eeda167938a6a48deaaf8c27b34c6e1c666578382a712547a6907091eeb8453aa38aaced74fedeb492b6803f77ab21411e2dc1fabad9b6f9b5dd5a0f51d9
|
data/.travis.yml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
language: ruby
|
2
|
+
before_install:
|
3
|
+
- gem install bundler
|
4
|
+
before_script:
|
5
|
+
- bundle update
|
6
|
+
- "bundle exec rake compile"
|
7
|
+
cache: bundler
|
8
|
+
rvm:
|
9
|
+
- 2.0.0
|
10
|
+
- 2.1.8
|
11
|
+
- 2.2.4
|
12
|
+
- 2.3.0
|
13
|
+
- ruby-head
|
14
|
+
notifications:
|
15
|
+
emails:
|
16
|
+
- tsukasa.oishi@gmail.com
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at tsukasa.oishi@gmail.com. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Tsukasa OISHI
|
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
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# WordScoop
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/word_scoop.svg)](http://badge.fury.io/rb/word_scoop) [![Build Status](https://travis-ci.org/tsukasaoishi/word_scoop.svg?branch=master)](https://travis-ci.org/tsukasaoishi/word_scoop) [![Code Climate](https://codeclimate.com/github/tsukasaoishi/word_scoop/badges/gpa.svg)](https://codeclimate.com/github/tsukasaoishi/word_scoop)
|
4
|
+
|
3
5
|
WordScoop will pick up keywords that have been pre-registered from the text.
|
4
6
|
WordScoop is very fast library. The average of registring 1 word time is 0.487 µs. The average of to search time is 1.248 ms.(Be performed on the Macbook air at 2012)
|
5
7
|
Try ```bundle exec rake benchmark```
|
data/ext/word_scoop/word_scoop.c
CHANGED
@@ -213,7 +213,7 @@ static VALUE t_search(VALUE self, VALUE str)
|
|
213
213
|
/**
|
214
214
|
* filter_html
|
215
215
|
**/
|
216
|
-
static VALUE
|
216
|
+
static VALUE t_filter_html(VALUE self, VALUE str)
|
217
217
|
{
|
218
218
|
node root, now, ret;
|
219
219
|
bool in_tag;
|
@@ -338,6 +338,6 @@ void Init_word_scoop() {
|
|
338
338
|
rb_define_singleton_method(cWordScoop, "new", t_new, -1);
|
339
339
|
rb_define_method(cWordScoop, "add", t_add, 1);
|
340
340
|
rb_define_method(cWordScoop, "search", t_search, 1);
|
341
|
-
rb_define_method(cWordScoop, "filter_html",
|
341
|
+
rb_define_method(cWordScoop, "filter_html", t_filter_html, 1);
|
342
342
|
rb_define_alias(cWordScoop, "<<", "add");
|
343
343
|
}
|
data/lib/word_scoop/version.rb
CHANGED
data/word_scoop.gemspec
CHANGED
@@ -13,14 +13,16 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.homepage = "https://github.com/tsukasaoishi/word_scoop"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
16
|
-
spec.files = `git ls-files -z`.split("\x0")
|
17
|
-
spec.
|
18
|
-
spec.
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
spec.bindir = "exe"
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
19
|
spec.require_paths = ["lib", "ext"]
|
20
20
|
spec.extensions = ["ext/word_scoop/extconf.rb"]
|
21
21
|
|
22
|
-
spec.
|
23
|
-
|
24
|
-
spec.add_development_dependency "
|
22
|
+
spec.required_ruby_version = '>= 2.0'
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", ">= 1.3.0", "< 2.0"
|
25
|
+
spec.add_development_dependency "rake", ">= 0.8.7"
|
26
|
+
spec.add_development_dependency "rspec"
|
25
27
|
spec.add_development_dependency "rake-compiler", '~> 0.9'
|
26
28
|
end
|
metadata
CHANGED
@@ -1,57 +1,63 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: word_scoop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tsukasa OISHI
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.3.0
|
20
|
+
- - "<"
|
18
21
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
22
|
+
version: '2.0'
|
20
23
|
type: :development
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
29
|
+
version: 1.3.0
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '2.0'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: rake
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
|
-
- - "
|
37
|
+
- - ">="
|
32
38
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
39
|
+
version: 0.8.7
|
34
40
|
type: :development
|
35
41
|
prerelease: false
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
37
43
|
requirements:
|
38
|
-
- - "
|
44
|
+
- - ">="
|
39
45
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
46
|
+
version: 0.8.7
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: rspec
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
|
-
- - "
|
51
|
+
- - ">="
|
46
52
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
53
|
+
version: '0'
|
48
54
|
type: :development
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
51
57
|
requirements:
|
52
|
-
- - "
|
58
|
+
- - ">="
|
53
59
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
60
|
+
version: '0'
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
62
|
name: rake-compiler
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -76,8 +82,11 @@ extensions:
|
|
76
82
|
extra_rdoc_files: []
|
77
83
|
files:
|
78
84
|
- ".gitignore"
|
85
|
+
- ".travis.yml"
|
86
|
+
- CODE_OF_CONDUCT.md
|
79
87
|
- Gemfile
|
80
88
|
- History.txt
|
89
|
+
- LICENSE.txt
|
81
90
|
- Manifest.txt
|
82
91
|
- README.md
|
83
92
|
- Rakefile
|
@@ -89,8 +98,6 @@ files:
|
|
89
98
|
- ext/word_scoop/word_scoop.h
|
90
99
|
- lib/word_scoop.rb
|
91
100
|
- lib/word_scoop/version.rb
|
92
|
-
- spec/spec_helper.rb
|
93
|
-
- spec/unit/word_scoop_spec.rb
|
94
101
|
- word_scoop.gemspec
|
95
102
|
homepage: https://github.com/tsukasaoishi/word_scoop
|
96
103
|
licenses:
|
@@ -105,7 +112,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
105
112
|
requirements:
|
106
113
|
- - ">="
|
107
114
|
- !ruby/object:Gem::Version
|
108
|
-
version: '0'
|
115
|
+
version: '2.0'
|
109
116
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
117
|
requirements:
|
111
118
|
- - ">="
|
@@ -113,10 +120,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
120
|
version: '0'
|
114
121
|
requirements: []
|
115
122
|
rubyforge_project:
|
116
|
-
rubygems_version: 2.
|
123
|
+
rubygems_version: 2.5.1
|
117
124
|
signing_key:
|
118
125
|
specification_version: 4
|
119
126
|
summary: WordScoop will pick up keywords that have been pre-registered from the text.
|
120
|
-
test_files:
|
121
|
-
- spec/spec_helper.rb
|
122
|
-
- spec/unit/word_scoop_spec.rb
|
127
|
+
test_files: []
|
data/spec/spec_helper.rb
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
require 'spec_helper'
|
3
|
-
|
4
|
-
describe WordScoop do
|
5
|
-
before(:each) do
|
6
|
-
keywords = %w|ninja 忍者|
|
7
|
-
@tree = WordScoop.new(keywords)
|
8
|
-
end
|
9
|
-
|
10
|
-
context "#serch" do
|
11
|
-
it "pickup keywords" do
|
12
|
-
pickup = @tree.search("I am a ninja. 私は忍者です。Are you a ninja?")
|
13
|
-
expect(pickup).to eq(%w|ninja 忍者 ninja|)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
context "#filter_html" do
|
18
|
-
it "add link to keywords" do
|
19
|
-
text = "I am a ninja. 私は忍者です。Are you a ninja?"
|
20
|
-
html = @tree.filter_html(text)
|
21
|
-
expect(html).to eq(
|
22
|
-
text.gsub(/ninja|忍者/) do |keyword|
|
23
|
-
"<a href='http://ja.wikipedia.org/wiki/#{keyword}'>#{keyword}</a>"
|
24
|
-
end
|
25
|
-
)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|