vidibus-words 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/lib/vidibus/words.rb +4 -3
- data/lib/vidibus-words.rb +1 -0
- metadata +135 -126
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Vidibus::Words [![](
|
1
|
+
# Vidibus::Words [![Build Status](https://travis-ci.org/vidibus/vidibus-words.png)](https://travis-ci.org/vidibus/vidibus-words)
|
2
2
|
|
3
3
|
This gem provides handling of words. It ships with a list of stop words in English, German, and Spanish and allows extraction of keywords from a string.
|
4
4
|
|
data/lib/vidibus/words.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
module Vidibus
|
3
3
|
class Words
|
4
|
-
VERSION = '0.0.
|
4
|
+
VERSION = '0.0.3'
|
5
5
|
|
6
6
|
class MissingLocaleError < StandardError; end
|
7
7
|
|
8
8
|
def initialize(input, loc = [])
|
9
|
-
@input = input
|
9
|
+
@input = input || ''
|
10
10
|
self.locale = loc
|
11
11
|
end
|
12
12
|
|
@@ -71,6 +71,7 @@ module Vidibus
|
|
71
71
|
|
72
72
|
# Returns a list of words from given string.
|
73
73
|
def words(string)
|
74
|
+
return [] if string.nil?
|
74
75
|
allowed = [' ', 'a-z', 'A-Z', '0-9'] + String::LATIN_MAP.values
|
75
76
|
disallowed = ['¿', '¡'] # Add some disallowed chars that cannot be catched. TODO: Improve!
|
76
77
|
match = /[^#{allowed.join('')}]/
|
@@ -90,7 +91,7 @@ module Vidibus
|
|
90
91
|
map = {}
|
91
92
|
count = [999, list.length].min
|
92
93
|
for word in list
|
93
|
-
word.downcase
|
94
|
+
word = word.downcase
|
94
95
|
map[word] ||= count
|
95
96
|
map[word] += 1000
|
96
97
|
count -= 1 if count > 0
|
data/lib/vidibus-words.rb
CHANGED
metadata
CHANGED
@@ -1,132 +1,150 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: vidibus-words
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 2
|
10
|
-
version: 0.0.2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Andre Pankratz
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2014-04-22 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
22
15
|
name: rails
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
hash: 5
|
30
|
-
segments:
|
31
|
-
- 3
|
32
|
-
version: "3"
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '3'
|
33
22
|
type: :runtime
|
34
|
-
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: vidibus-core_extensions
|
37
23
|
prerelease: false
|
38
|
-
|
39
|
-
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: vidibus-core_extensions
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 0.4.1
|
47
38
|
type: :runtime
|
48
|
-
version_requirements: *id002
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: bundler
|
51
39
|
prerelease: false
|
52
|
-
|
53
|
-
none: false
|
54
|
-
requirements:
|
55
|
-
- -
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.4.1
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: bundler
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
62
53
|
version: 1.0.0
|
63
54
|
type: :development
|
64
|
-
version_requirements: *id003
|
65
|
-
- !ruby/object:Gem::Dependency
|
66
|
-
name: rake
|
67
55
|
prerelease: false
|
68
|
-
|
69
|
-
none: false
|
70
|
-
requirements:
|
71
|
-
- -
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.0.0
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rake
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
77
70
|
type: :development
|
78
|
-
version_requirements: *id004
|
79
|
-
- !ruby/object:Gem::Dependency
|
80
|
-
name: rdoc
|
81
71
|
prerelease: false
|
82
|
-
|
83
|
-
none: false
|
84
|
-
requirements:
|
85
|
-
- -
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rdoc
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
91
86
|
type: :development
|
92
|
-
version_requirements: *id005
|
93
|
-
- !ruby/object:Gem::Dependency
|
94
|
-
name: rspec
|
95
87
|
prerelease: false
|
96
|
-
|
97
|
-
none: false
|
98
|
-
requirements:
|
99
|
-
- -
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: rspec
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
105
102
|
type: :development
|
106
|
-
|
107
|
-
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
108
111
|
name: rr
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
109
119
|
prerelease: false
|
110
|
-
|
111
|
-
none: false
|
112
|
-
requirements:
|
113
|
-
- -
|
114
|
-
- !ruby/object:Gem::Version
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: simplecov
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
119
134
|
type: :development
|
120
|
-
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
121
142
|
description: Contains stop words lists and methods to extract keywords from strings.
|
122
143
|
email: andre@vidibus.com
|
123
144
|
executables: []
|
124
|
-
|
125
145
|
extensions: []
|
126
|
-
|
127
146
|
extra_rdoc_files: []
|
128
|
-
|
129
|
-
files:
|
147
|
+
files:
|
130
148
|
- lib/vidibus/words.rb
|
131
149
|
- lib/vidibus-words.rb
|
132
150
|
- config/locales/de.yml
|
@@ -135,41 +153,32 @@ files:
|
|
135
153
|
- LICENSE
|
136
154
|
- README.md
|
137
155
|
- Rakefile
|
138
|
-
has_rdoc: true
|
139
156
|
homepage: https://github.com/vidibus/vidibus-words
|
140
|
-
licenses:
|
141
|
-
|
157
|
+
licenses:
|
158
|
+
- MIT
|
142
159
|
post_install_message:
|
143
160
|
rdoc_options: []
|
144
|
-
|
145
|
-
require_paths:
|
161
|
+
require_paths:
|
146
162
|
- lib
|
147
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
163
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
148
164
|
none: false
|
149
|
-
requirements:
|
150
|
-
- -
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
|
153
|
-
segments:
|
165
|
+
requirements:
|
166
|
+
- - ! '>='
|
167
|
+
- !ruby/object:Gem::Version
|
168
|
+
version: '0'
|
169
|
+
segments:
|
154
170
|
- 0
|
155
|
-
|
156
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
171
|
+
hash: -608889428197018192
|
172
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
173
|
none: false
|
158
|
-
requirements:
|
159
|
-
- -
|
160
|
-
- !ruby/object:Gem::Version
|
161
|
-
hash: 23
|
162
|
-
segments:
|
163
|
-
- 1
|
164
|
-
- 3
|
165
|
-
- 6
|
174
|
+
requirements:
|
175
|
+
- - ! '>='
|
176
|
+
- !ruby/object:Gem::Version
|
166
177
|
version: 1.3.6
|
167
178
|
requirements: []
|
168
|
-
|
169
179
|
rubyforge_project: vidibus-words
|
170
|
-
rubygems_version: 1.
|
180
|
+
rubygems_version: 1.8.24
|
171
181
|
signing_key:
|
172
182
|
specification_version: 3
|
173
183
|
summary: Tools for handling (stop-) words
|
174
184
|
test_files: []
|
175
|
-
|