weighted_list_rank 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -1
- data/Gemfile.lock +8 -10
- data/lib/weighted_list_rank/strategies/exponential.rb +9 -1
- data/lib/weighted_list_rank/version.rb +1 -1
- data/weighted_list_rank.gemspec +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e3b387809912d1000f8f8ee13704cec1b04d691b783d6bd19a9f9b6e6cf0d6d
|
4
|
+
data.tar.gz: caadd577bf061e63c1357943da439e06d6c1c5e441bb84ddbff250fb49a45020
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb8c04911951b50c39b7f45583b1932274377106357fae605185bad10f8e37fb4e5c86047698e5e1752778311a5ea3403ce82fe494d44035ac889625b0703056
|
7
|
+
data.tar.gz: 955ad9589e4418ca509065a7dc92b23af4c3c962ee8523ab89585bda58f04a9cedbedc11124523c69b385ba3f146d7db6856be6f86dc66143c251055b69bc545
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
-
## [
|
1
|
+
## [0.5.3] - 2024-08-22
|
2
|
+
- Fixed an issue in the `Exponential` strategy where items with positions higher than the total number of items in a list could cause errors. Now, such items are treated as if they were in the last position, and a warning is logged.
|
3
|
+
- Added a new test case to verify the handling of items with positions exceeding the list size.
|
4
|
+
- Updated all dependencies to their latest versions.
|
2
5
|
|
3
6
|
## [0.5.2] - 2024-08-21
|
4
7
|
- Fixed an issue in the `Exponential` strategy where `score_penalty` was not being applied to unranked items. Now, `score_penalty` is correctly applied to both ranked and unranked items, ensuring consistent scoring behavior.
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
weighted_list_rank (0.
|
4
|
+
weighted_list_rank (0.5.3)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -12,15 +12,14 @@ GEM
|
|
12
12
|
lint_roller (1.1.0)
|
13
13
|
minitest (5.25.1)
|
14
14
|
parallel (1.26.3)
|
15
|
-
parser (3.3.
|
15
|
+
parser (3.3.5.0)
|
16
16
|
ast (~> 2.4.1)
|
17
17
|
racc
|
18
18
|
racc (1.8.1)
|
19
19
|
rainbow (3.1.1)
|
20
20
|
rake (13.2.1)
|
21
21
|
regexp_parser (2.9.2)
|
22
|
-
rexml (3.3.
|
23
|
-
strscan
|
22
|
+
rexml (3.3.8)
|
24
23
|
rubocop (1.65.1)
|
25
24
|
json (~> 2.3)
|
26
25
|
language_server-protocol (>= 3.17.0)
|
@@ -32,9 +31,9 @@ GEM
|
|
32
31
|
rubocop-ast (>= 1.31.1, < 2.0)
|
33
32
|
ruby-progressbar (~> 1.7)
|
34
33
|
unicode-display_width (>= 2.4.0, < 3.0)
|
35
|
-
rubocop-ast (1.32.
|
34
|
+
rubocop-ast (1.32.3)
|
36
35
|
parser (>= 3.3.1.0)
|
37
|
-
rubocop-minitest (0.
|
36
|
+
rubocop-minitest (0.36.0)
|
38
37
|
rubocop (>= 1.61, < 2.0)
|
39
38
|
rubocop-ast (>= 1.31.1, < 2.0)
|
40
39
|
rubocop-performance (1.21.1)
|
@@ -43,7 +42,7 @@ GEM
|
|
43
42
|
rubocop-rake (0.6.0)
|
44
43
|
rubocop (~> 1.0)
|
45
44
|
ruby-progressbar (1.13.0)
|
46
|
-
standard (1.40.
|
45
|
+
standard (1.40.1)
|
47
46
|
language_server-protocol (~> 3.17.0.2)
|
48
47
|
lint_roller (~> 1.0)
|
49
48
|
rubocop (~> 1.65.0)
|
@@ -55,8 +54,7 @@ GEM
|
|
55
54
|
standard-performance (1.4.0)
|
56
55
|
lint_roller (~> 1.1)
|
57
56
|
rubocop-performance (~> 1.21.0)
|
58
|
-
|
59
|
-
unicode-display_width (2.5.0)
|
57
|
+
unicode-display_width (2.6.0)
|
60
58
|
|
61
59
|
PLATFORMS
|
62
60
|
x86_64-linux
|
@@ -67,7 +65,7 @@ DEPENDENCIES
|
|
67
65
|
rubocop (~> 1.21)
|
68
66
|
rubocop-minitest (~> 0.3)
|
69
67
|
rubocop-rake (~> 0.6)
|
70
|
-
standard (
|
68
|
+
standard (>= 1.35.1)
|
71
69
|
weighted_list_rank!
|
72
70
|
|
73
71
|
BUNDLED WITH
|
@@ -64,8 +64,16 @@ module WeightedListRank
|
|
64
64
|
score += unranked_bonus
|
65
65
|
end
|
66
66
|
else
|
67
|
+
# Check if the item's position is higher than the total number of items
|
68
|
+
if item.position > total_items
|
69
|
+
puts "Warning: Item position (#{item.position}) is higher than the total number of items (#{total_items}) in the list. Using total items as position."
|
70
|
+
item_position = total_items
|
71
|
+
else
|
72
|
+
item_position = item.position
|
73
|
+
end
|
74
|
+
|
67
75
|
# Ranked items receive a bonus calculated using the exponential formula
|
68
|
-
exponential_factor = (total_items + 1 -
|
76
|
+
exponential_factor = (total_items + 1 - item_position)**exponent
|
69
77
|
total_exponential_factor = (1..total_items).sum { |pos| (total_items + 1 - pos)**exponent }
|
70
78
|
|
71
79
|
# Allocate a portion of the adjusted bonus pool based on the item's exponential factor
|
data/weighted_list_rank.gemspec
CHANGED
@@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
|
|
34
34
|
# Uncomment to register a new dependency of your gem
|
35
35
|
# spec.add_dependency "example-gem", "~> 1.0"
|
36
36
|
spec.add_development_dependency "rubocop", "~> 1.0"
|
37
|
-
spec.add_development_dependency "standard", "
|
37
|
+
spec.add_development_dependency "standard", ">= 1.35.1"
|
38
38
|
spec.add_development_dependency "rubocop-minitest", "~> 0.3"
|
39
39
|
spec.add_development_dependency "rubocop-rake", "~> 0.6"
|
40
40
|
# For more information and examples about making a new gem, check out our
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: weighted_list_rank
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shane Sherman
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: standard
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 1.35.1
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 1.35.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rubocop-minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|