<jupyter_start><jupyter_text>Flavour AnalysisFlavours can be (roughly) pinned down on a handful of aromatic compounds. Complementary pairings tend to exploit similarities in ingredients, either through their lineage (carrots and dill are good) or through the overlap of the compounds they produce (cinnamon and cloves both contain eugenol).Can Wikipedia tell us what spices and herbs we should: * pair to make tasty food; and * substitute when we're missing some?<jupyter_code>library(jsonlite)
install.packages('curl')
category.contents <- function(categories){
    
    lapply(categories, function(cat.q){fromJSON(paste0("https://en.wikipedia.org/w/api.php?action=query&list=categorymembers&cmtitle=",cat.q, "&cmtype=page&cmlimit=1000&format=json"))$query$categorymembers})
}
(flavours <- category.contents("Category:Flavors")) 
flavours$query$categorymembers
(spices.herbs <- category.contents(c("Category:Herbs","Category:Spices")))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11283643892339544, 'fraction_numerical': 0.005175983436853002, 'mean_word_length': 7.711711711711712, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '237351', 'license': 'BSD-2-Clause', 'n_tokens_mistral': 304, 'n_tokens_neox': 277, 'n_words': 76, 'path': 'get_data.ipynb', 'repo_name': 'mathew-hall/flavours', 'size': '966'}