Perform a random selection (weighted) of ingredients from the data files.
Update the ingredient files and run! The script will automatically decrement the weights of its selections to promote new items.
❯ python3 ingredient_selector.py --help
usage: ingredient_selector [-h] [-k K] [-u]
Randomly select ingredients from dataset files for #club-cooking challenge!
optional arguments:
-h, --help show this help message and exit
-k K Number of random values to return.
-u, --update Flag indicating if ingredient weights should be updated.
$ chmod u+x ingredient_selector.py
# Test it out with a random selection.
❯ python3 ingredient_selector.py
fruit.csv: Selected orange at weight 100
vegetable.csv: Selected tomatillo at weight 100
protein.csv: Selected lamb at weight 100
# Make a legit selection and update the weights.
❯ python3 ingredient_selector.py --update
fruit.csv: Selected pear at weight 50
fruit.csv: Updated pear to weight 25
vegetable.csv: Selected asparagas at weight 12
vegetable.csv: Updated asparagas to weight 6
protein.csv: Selected beef at weight 12
protein.csv: Updated beef to weight 6