linnaeus 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b380bea103cd6825850436184c4ab35c9c07c089
4
- data.tar.gz: 147508ab8b2610250a82acf5d11721040d9c721d
3
+ metadata.gz: df43732df7d9d0ef05621e4b61689ff5caca13c9
4
+ data.tar.gz: da7169077289b7edea978906dd0918549a339c6a
5
5
  SHA512:
6
- metadata.gz: 12ef0f679970ad545fc3942f26a709626ed43647bbeb454656fb39c908691434746dd3cf21c3cc658be534a814c73aa5572af1e1c466c1f89048d326516dc97f
7
- data.tar.gz: d982a11641d6be711117b270850d7309881ad74b4e5278f484bced8f1703a36bd058e7de093883f520916c378eba353ae3c01b331461301f41139699657bed8a
6
+ metadata.gz: 39629861a50d32557e78191fb804cfa51d1051b122c1d32cb0729a7317c724514c47f0101e0fcb53d2459f5ee21bb06c630295aec77f06cd4261083c398f8b27
7
+ data.tar.gz: 3b364ee8fbecc54a9e589e4902c63132dee0ab940ec70f0ca5f399b97317e7c8f699526d6b6a697b1b8a85afaa89cde3bc61fa0c25ad86cb0a73b04605cde04b
@@ -1 +1 @@
1
- 2.0.0-p0
1
+ 2.0.0-p353
@@ -3,49 +3,52 @@ GEM
3
3
  specs:
4
4
  addressable (2.3.5)
5
5
  builder (3.2.2)
6
+ descendants_tracker (0.0.3)
6
7
  diff-lcs (1.1.3)
7
- faraday (0.8.7)
8
- multipart-post (~> 1.1)
9
- git (1.2.5)
10
- github_api (0.10.1)
11
- addressable
12
- faraday (~> 0.8.1)
8
+ docile (1.1.3)
9
+ faraday (0.9.0)
10
+ multipart-post (>= 1.2, < 3)
11
+ git (1.2.6)
12
+ github_api (0.11.3)
13
+ addressable (~> 2.3)
14
+ descendants_tracker (~> 0.0.1)
15
+ faraday (~> 0.8, < 0.10)
13
16
  hashie (>= 1.2)
14
- multi_json (~> 1.4)
15
- nokogiri (~> 1.5.2)
17
+ multi_json (>= 1.7.5, < 2.0)
18
+ nokogiri (~> 1.6.0)
16
19
  oauth2
17
20
  hashie (2.0.5)
18
- highline (1.6.19)
19
- httpauth (0.2.0)
20
- jeweler (1.8.6)
21
+ highline (1.6.21)
22
+ jeweler (2.0.1)
21
23
  builder
22
- bundler (~> 1.0)
24
+ bundler (>= 1.0)
23
25
  git (>= 1.2.5)
24
- github_api (= 0.10.1)
26
+ github_api
25
27
  highline (>= 1.6.15)
26
- nokogiri (= 1.5.10)
28
+ nokogiri (>= 1.5.10)
27
29
  rake
28
30
  rdoc
29
- json (1.8.0)
30
- jwt (0.1.8)
31
+ json (1.8.1)
32
+ jwt (0.1.11)
31
33
  multi_json (>= 1.5)
32
- multi_json (1.7.7)
33
- multi_xml (0.5.4)
34
- multipart-post (1.2.0)
35
- nokogiri (1.5.10)
36
- oauth2 (0.9.2)
37
- faraday (~> 0.8)
38
- httpauth (~> 0.2)
39
- jwt (~> 0.1.4)
40
- multi_json (~> 1.0)
34
+ mini_portile (0.5.2)
35
+ multi_json (1.9.0)
36
+ multi_xml (0.5.5)
37
+ multipart-post (2.0.0)
38
+ nokogiri (1.6.1)
39
+ mini_portile (~> 0.5.0)
40
+ oauth2 (0.9.3)
41
+ faraday (>= 0.8, < 0.10)
42
+ jwt (~> 0.1.8)
43
+ multi_json (~> 1.3)
41
44
  multi_xml (~> 0.5)
42
45
  rack (~> 1.2)
43
46
  rack (1.5.2)
44
- rake (10.1.0)
47
+ rake (10.1.1)
45
48
  rdoc (3.12.2)
46
49
  json (~> 1.4)
47
- redcarpet (3.0.0)
48
- redis (3.0.4)
50
+ redcarpet (3.1.1)
51
+ redis (3.0.7)
49
52
  rspec (2.11.0)
50
53
  rspec-core (~> 2.11.0)
51
54
  rspec-expectations (~> 2.11.0)
@@ -54,12 +57,13 @@ GEM
54
57
  rspec-expectations (2.11.3)
55
58
  diff-lcs (~> 1.1.3)
56
59
  rspec-mocks (2.11.3)
57
- simplecov (0.7.1)
58
- multi_json (~> 1.0)
59
- simplecov-html (~> 0.7.1)
60
- simplecov-html (0.7.1)
60
+ simplecov (0.8.2)
61
+ docile (~> 1.1.0)
62
+ multi_json
63
+ simplecov-html (~> 0.8.0)
64
+ simplecov-html (0.8.0)
61
65
  stemmer (1.0.1)
62
- yard (0.8.6.2)
66
+ yard (0.8.7.3)
63
67
 
64
68
  PLATFORMS
65
69
  ruby
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 1.2.0
@@ -13,6 +13,8 @@
13
13
  # Set to true to skip porter stemming.
14
14
  # encoding::
15
15
  # Force text to use this character set. UTF-8 by default.
16
+ # redis_connection::
17
+ # An instantiated Redis connection, allowing you to reuse an existing Redis connection.
16
18
  # redis_host::
17
19
  # Passed to persistence class constructor. Defaults to "127.0.0.1"
18
20
  # redis_port::
@@ -18,17 +18,21 @@ class Linnaeus::Persistence < Linnaeus
18
18
 
19
19
  @scope = options[:scope]
20
20
 
21
- @redis = Redis.new(
22
- host: options[:redis_host],
23
- port: options[:redis_port],
24
- db: options[:redis_db],
25
- scheme: options[:redis_scheme],
26
- path: options[:redis_path],
27
- timeout: options[:redis_timeout],
28
- password: options[:redis_password],
29
- id: options[:redis_id],
30
- tcp_keepalive: options[:redis_tcp_keepalive]
31
- )
21
+ if options[:redis_connection]
22
+ @redis = options[:redis_connection]
23
+ else
24
+ @redis = Redis.new(
25
+ host: options[:redis_host],
26
+ port: options[:redis_port],
27
+ db: options[:redis_db],
28
+ scheme: options[:redis_scheme],
29
+ path: options[:redis_path],
30
+ timeout: options[:redis_timeout],
31
+ password: options[:redis_password],
32
+ id: options[:redis_id],
33
+ tcp_keepalive: options[:redis_tcp_keepalive]
34
+ )
35
+ end
32
36
 
33
37
  self
34
38
  end
@@ -2,14 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
+ # stub: linnaeus 1.2.0 ruby lib
5
6
 
6
7
  Gem::Specification.new do |s|
7
8
  s.name = "linnaeus"
8
- s.version = "1.1.0"
9
+ s.version = "1.2.0"
9
10
 
10
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib"]
11
13
  s.authors = ["djcp"]
12
- s.date = "2013-07-12"
14
+ s.date = "2014-03-18"
13
15
  s.description = "Linnaeus provides a redis-backed Bayesian classifier. Words are stemmed, stopwords are stopped, and redis is used to allow for persistent and concurrent training and classification."
14
16
  s.email = "dan@collispuro.net"
15
17
  s.extra_rdoc_files = [
@@ -43,8 +45,7 @@ Gem::Specification.new do |s|
43
45
  ]
44
46
  s.homepage = "http://github.com/djcp/linnaeus"
45
47
  s.licenses = ["MIT"]
46
- s.require_paths = ["lib"]
47
- s.rubygems_version = "2.0.0"
48
+ s.rubygems_version = "2.2.1"
48
49
  s.summary = "Another redis-backed Bayesian classifier"
49
50
 
50
51
  if s.respond_to? :specification_version then
@@ -6,10 +6,15 @@ describe Linnaeus::Persistence do
6
6
  lp.clear_training_data
7
7
  end
8
8
 
9
+ it "should accept an existing redis connection" do
10
+ lp = Linnaeus::Persistence.new(redis_connection: Redis.new)
11
+ lp.redis.should_not be_nil
12
+ end
13
+
9
14
  it 'sets keys properly with defaults' do
10
15
  lp2 = get_linnaeus_persistence
11
16
  train_a_document_in('foobar')
12
- lp2.redis.keys('*').should eq ['Linnaeus:category', 'Linnaeus:cat:foobar']
17
+ lp2.redis.keys('*').should match_array ['Linnaeus:category', 'Linnaeus:cat:foobar']
13
18
  end
14
19
 
15
20
  context "custom scopes" do
@@ -19,7 +24,7 @@ describe Linnaeus::Persistence do
19
24
 
20
25
  train_a_document_in('foobar', scope: 'new-scope')
21
26
 
22
- lp2.redis.keys('*').sort.should eq [
27
+ lp2.redis.keys('*').should match_array [
23
28
  'Linnaeus:new-scope:cat:foobar', 'Linnaeus:new-scope:category'
24
29
  ]
25
30
  end
@@ -33,14 +38,14 @@ describe Linnaeus::Persistence do
33
38
 
34
39
  train_a_document_in('foobar', scope: 'new-scope')
35
40
 
36
- lp.redis.keys.sort.should eq [
41
+ lp.redis.keys.should match_array [
37
42
  "Linnaeus:cat:foobar", "Linnaeus:category",
38
43
  "Linnaeus:new-scope:cat:foobar", "Linnaeus:new-scope:category"
39
44
  ]
40
45
 
41
46
  lp2.clear_training_data
42
47
 
43
- lp.redis.keys.sort.should eq [
48
+ lp.redis.keys.should match_array [
44
49
  "Linnaeus:cat:foobar", "Linnaeus:category"
45
50
  ]
46
51
  end
@@ -52,8 +57,8 @@ describe Linnaeus::Persistence do
52
57
  lp2 = get_linnaeus_persistence(scope: 'new-scope')
53
58
  add_categories lp2, ['slack' , 'frop']
54
59
 
55
- lp2.get_categories.sort.should eq ['frop', 'slack']
56
- lp.get_categories.sort.should eq ['bar','baz','foo']
60
+ lp2.get_categories.should match_array ['frop', 'slack']
61
+ lp.get_categories.should match_array ['bar','baz','foo']
57
62
  end
58
63
  end
59
64
 
@@ -68,14 +73,14 @@ describe Linnaeus::Persistence do
68
73
  it 'stores categories successfully' do
69
74
  lp = get_linnaeus_persistence
70
75
  add_categories lp
71
- lp.get_categories.sort.should eq ['bar','baz','foo']
76
+ lp.get_categories.should match_array ['bar','baz','foo']
72
77
  end
73
78
 
74
79
  it 'can remove categories' do
75
80
  lp = get_linnaeus_persistence
76
81
  add_categories lp
77
82
  lp.remove_category 'bar'
78
- lp.get_categories.sort.should eq ['baz','foo']
83
+ lp.get_categories.should match_array ['baz','foo']
79
84
  end
80
85
 
81
86
  it '#get_words_with_count_for_category' do
@@ -14,7 +14,7 @@ describe Linnaeus::Stopwords do
14
14
  end
15
15
  it 'can have stopwords overridden' do
16
16
  subject.stopwords = ['foo','bar']
17
- subject.to_a.should eq ['foo','bar']
17
+ subject.to_a.should match_array ['foo','bar']
18
18
  subject.to_set.should eq ['foo','bar'].to_set
19
19
  end
20
20
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linnaeus
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - djcp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-12 00:00:00.000000000 Z
11
+ date: 2014-03-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis
@@ -189,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
189
189
  version: '0'
190
190
  requirements: []
191
191
  rubyforge_project:
192
- rubygems_version: 2.0.0
192
+ rubygems_version: 2.2.1
193
193
  signing_key:
194
194
  specification_version: 4
195
195
  summary: Another redis-backed Bayesian classifier