commendo 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/commendo/pair_comparison.lua +7 -2
- data/lib/commendo/version.rb +1 -1
- data/test/content_set_test.rb +16 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80baa49ab8364f70fd8dd4f2127f95d4f5ad0da2
|
4
|
+
data.tar.gz: 355812df077e1df1cb4d0425fb36fac8334d19f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1c2164296cfe3c47d0ef943594aeb6b4f20a007f421729ddd5b4328c3ffd2e90033f7315fac9451f98f39a088b504f0252cc3540a75560f6df9b4052bc4c9b6
|
7
|
+
data.tar.gz: 5d31d9f878a2eb7ab19e97b13887adb95b3df416866993b5c9ff8008a21f24b97c7acaf685a1baeb17d9003fa6716a5b1d5041efe057de1f2dc70327c8eba4df
|
data/CHANGELOG.md
CHANGED
@@ -4,8 +4,8 @@ local left_similarity_key = KEYS[3]
|
|
4
4
|
local right_similarity_key = KEYS[4]
|
5
5
|
|
6
6
|
local tmp_key_base = ARGV[1]
|
7
|
-
local left =
|
8
|
-
local right =
|
7
|
+
local left = ARGV[2]
|
8
|
+
local right = ARGV[3]
|
9
9
|
local threshold = tonumber(ARGV[4])
|
10
10
|
|
11
11
|
local function round(num, idp)
|
@@ -40,9 +40,14 @@ if table.getn(intersect) > 0 then
|
|
40
40
|
end
|
41
41
|
|
42
42
|
local similarity = round(intersect_score / union_score, 3)
|
43
|
+
redis.log(redis.LOG_NOTICE, 'Similarity from pair comparison for ' .. left_key .. ' ' .. right_key .. ', ' .. similarity .. ', ' .. threshold)
|
43
44
|
if similarity > threshold then
|
45
|
+
redis.log(redis.LOG_NOTICE, 'Saving ' .. left_similarity_key .. ', ' .. similarity .. ', ' .. right)
|
44
46
|
redis.call('ZADD', left_similarity_key, similarity, right)
|
47
|
+
redis.log(redis.LOG_NOTICE, 'Saving ' .. right_similarity_key .. ', ' .. similarity .. ', ' .. left)
|
45
48
|
redis.call('ZADD', right_similarity_key, similarity, left)
|
49
|
+
else
|
50
|
+
redis.log(redis.LOG_NOTICE, 'NOT saving ' .. right_similarity_key .. ', ' .. similarity .. ', ' .. left)
|
46
51
|
end
|
47
52
|
end
|
48
53
|
|
data/lib/commendo/version.rb
CHANGED
data/test/content_set_test.rb
CHANGED
@@ -52,6 +52,22 @@ module Commendo
|
|
52
52
|
assert_equal expected, cs.similar_to('resource-1')
|
53
53
|
end
|
54
54
|
|
55
|
+
def test_recommends_with_large_number_of_groups
|
56
|
+
redis = Redis.new(db: 15)
|
57
|
+
redis.flushdb
|
58
|
+
key_base = 'CommendoTests'
|
59
|
+
cs = ContentSet.new(redis, key_base)
|
60
|
+
(0..3000).each do |i|
|
61
|
+
cs.add('resource-1', ["group-#{i}", i/100.0], ["group-#{i+1}", i/20.0])
|
62
|
+
cs.add('resource-9', ["group-#{i}", i/100.0], ["group-#{i+1}", i/20.0])
|
63
|
+
end
|
64
|
+
cs.calculate_similarity
|
65
|
+
expected = [
|
66
|
+
{resource: 'resource-9', similarity: 1.0}
|
67
|
+
]
|
68
|
+
assert_equal expected, cs.similar_to('resource-1')
|
69
|
+
end
|
70
|
+
|
55
71
|
def test_recommends_when_extra_scores_added
|
56
72
|
test_recommends_when_added_with_scores
|
57
73
|
redis = Redis.new(db: 15)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: commendo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Styles
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|