Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Sommelier provides a solution to a variant of the Stable Marriage problem in mathematics. In this gem, the classical suitors are replaced with dishes from a restaurant menu and the brides-to-be are wines.
The Stable Marriage Problem is a mathematical problem that attempts to uniquely match a set of N items (classically male suitors) with another set of N items (classically females the suitors wish to marry).
This gem provides a variant of the Gale-Shapely algorithm. Gale-Shapely guarantees a complete matching (i.e. every suitor is paired with exactly one female and vice versa). Though this algorithm assumes every member of either group has a complete ranking of the other group. For large populations, this is not always practical.
The algorithm applied here has a few key differences from Gale-Shapely
Because of these differences, not every dish or wine is guaranteed to be in the pairings map. Swapping the dish and wine sets in the match catalog alter the final set of pairings.
gem install tcollier-sommelier
require 'sommelier'
sommelier = Sommelier.new
sommelier.add_match('Asparagus', 'Pinot Noir', 0.366)
sommelier.add_match('Asparagus', 'Sauvignon Blanc', 0.453)
sommelier.add_match('Asparagus', 'Chardonnay', 0.245)
sommelier.add_match('Tofu', 'Rosé', 0.486)
sommelier.add_match('Tofu', 'Sauvignon Blanc', 0.304)
sommelier.add_match('Eggplant', 'Sauvignon Blanc', 0.299)
sommelier.add_match('Salmon', 'Sauvignon Blanc', 0.602)
puts sommelier.pairings
# {
# "Salmon" => "Sauvignon Blanc",
# "Tofu" => "Rosé",
# "Asparagus" => "Pinot Noir"
# }
# Note: neither "Eggplant" nor "Chardonnay" were matched in the pairings map
This gem provides a rake task to apply the Sommelier algorithm to a CSV file. The file must have a header row and the columns are expected to be in the following order:
dish
wine
score
Note: the header row is simply ignored, so the columns can be named anything.
Any additional columns will be ignored.
# matches.csv
dish,wine,score
Asparagus,Pinot Noir,0.366
Asparagus,Sauvignon Blanc,0.453
Asparagus,Chardonnay,0.245
Tofu,Rosé,0.486
Tofu,Sauvignon Blanc,0.304
Eggplant,Sauvignon Blanc,0.299
Salmon,Sauvignon Blanc,0.602
rake sommelier:from_csv matches.csv
# Salmon => Sauvignon Blanc
# Tofu => Rosé
# Asparagus => Pinot Noir
FAQs
Unknown package
We found that tcollier-sommelier demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.