Building a way to visualize The Flavor Bible, and develop flavor metrics to aid in recipe creation, menu development, and wine pairings.
The primary purpose of this tool is to help chefs discover and experiment with flavor combinations where their mistakes are cheap. This tool also has purpose in that looking at food through the flavor lense specifically, where cliques form and concepts converge, can help assist a wide range of users:
- farmers and growers
- baristas and bartenders
- stores and distributers
- chefs and homecooks
- brewers and vitners
Requires Python 3.11+ and uv:
uv sync
source .venv/bin/activateRun the complete pipeline:
python main.pyOutputs all data to data/:
bible.json- Raw parsed ingredient relationshipsclean.json- Normalized and cleaned datasimilarity.json- Jaccard similarity matrix (9.3MB)nodes.json- Network nodes for visualizationedges.json- Network edges for visualization
The data processing pipeline requires a few intermediate steps to turn the book into a usable, weighted data set that can be visualized.
-
parse the epub files from the book into json format
python src/pipeline/parse.pywhich generates data/bible.json. The numbers in the json represent an integral distance rank of an ingredient's importance to its source, and is directly based on the different impact typefaces used in the book.
We assume these html chapter files live in input/bible/.
- clean up the json, which outputs a better weighted
clean.json
python src/pipeline/clean.py data/bible.json data/clean.json- compute the similarity matrix in the jaccard metric, which makes a larger
similarity.json
python src/pipeline/similarity.py -i data/clean.json -o data/similarity.json- create the network graph data:
python src/pipeline/graph.py data/clean.json data/edges.json data/nodes.json- slice the graph:
python tools/slice.py -i data/nodes.json -e data/edges.json -n 'basil' -n 'garlic' -n 'olive oil'- generate a similarity heatmap from a list of input ingredients
python tools/heatmap.py -n 'basil' -n 'garlic' -n 'olive oil'- visualize ingredient networks
python tools/visualize.py -n 'basil' -n 'garlic'The preset nodes in visualize.py are the five ingredients of pesto.
python tools/visualize.py -o docs/img/pesto.png --no-showThat's just a quick and dirty preview without leaving Python. For an interactive visualization, see the demo at https://flavorpair.me!

