Chinese Cookbook: Difference between revisions

From FDHwiki
Jump to navigation Jump to search
 
(39 intermediate revisions by 3 users not shown)
Line 13: Line 13:


=== Deliverables ===
=== Deliverables ===
# Digitized recipes from the cookbook: One csv file containing recipe name, ingredients and cooking steps in Chinese and English
# [https://github.com/changchuntzu0618/DH405-CookingBook/blob/main/Dataset/full_recipe.csv Digitized recipes from the cookbook]: One csv file containing recipe name, ingredients and cooking steps in Chinese and English
# Categorized ingredients, effects, cooking methods, and cuisine categories: One csv file for each category
# [https://github.com/changchuntzu0618/DH405-CookingBook/tree/main/Dataset/categorize Categorized ingredients, effects, cooking methods, and cuisine categories]: One csv file for each category
# Website: One webpage displaying recipe entries and figures of data analysis with search functionality
# [https://sites.google.com/view/yinshanzhengyao/home Website]: One webpage displaying recipe entries and figures of data analysis with search functionality
# Wiki: One wiki page providing an introduction and comprehensive description of the entire project
# [https://fdh.epfl.ch/index.php/Chinese_Cookbook Wiki]: One wiki page providing an introduction and comprehensive description of the entire project
# Github: One Github repository to showcase all codes and technical aspects of the project
# [https://github.com/changchuntzu0618/DH405-CookingBook Github]: One Github repository to showcase all codes and technical aspects of the project


== Project Plan and Milestones ==
== Project Plan and Milestones ==
Line 24: Line 24:


{|class="wikitable"  
{|class="wikitable"  
!scope="col"|Date
!scope="col"|Week
!scope="col"|Data Collection
!scope="col"|Data Collection
!scope="col"|Data Processing
!scope="col"|Data Processing
Line 40: Line 40:
!scope="row"|Week 4
!scope="row"|Week 4
| Choose one historical Chinese cookbook
| Choose one historical Chinese cookbook
<br>Select the chapter to work on<br>
Select the chapter to work on
|rowspan="1"|  
|rowspan="1"|  
|rowspan="1"|  
|rowspan="1"|  
Line 49: Line 49:
| Get data from the website   
| Get data from the website   
| First clean and sort the data
| First clean and sort the data
<br>Construct the dataset of recipes<br>
Construct the dataset of recipes
<br>Find Ancient Chinese to Modern Chinese translation model<br>
Find Ancient Chinese to Modern Chinese translation model
|rowspan="1"|  
|rowspan="1"|  
|rowspan="1"|  
|rowspan="1"|  
Line 58: Line 58:
|rowspan="1"|
|rowspan="1"|
|Construct the dataset of ingredients
|Construct the dataset of ingredients
<br>Translating from Ancient Chinese to Modern Chinese<br>
Translating from Ancient Chinese to Modern Chinese
|rowspan="1"|  
|rowspan="1"|  
|rowspan="1"|  
|rowspan="1"|  
Line 73: Line 73:
|rowspan="1"|
|rowspan="1"|
|rowspan="1"|
|rowspan="1"|
|Analyse cooking method, effect, category, and ingredient frequency
|Data Analyse: category, ingredient, cooking method, and effect
<br>Visualization<br>
|Start web construction
|Start web construction
|-
|-
Line 81: Line 80:
|rowspan="1"|
|rowspan="1"|
|rowspan="1"|
|rowspan="1"|
|Analyse ingredient and ingredient category pairing  
|Data Analyse: ingredient and ingredient category pairing
<br>Visualization<br>
|Continue web construction
|Continue web construction
|-
|-
Line 89: Line 87:
|rowspan="1"|
|rowspan="1"|
|rowspan="1"|
|rowspan="1"|
|Analyse effect and ingredient pairing
|Data Analyse: effect and ingredient correlation
<br>Visualization<br>
|Continue web construction
|Continue web construction
<br>Construct recipe filtering and recommendation system<br>
Construct recipe filtering and recommendation system
|-
|-


Line 100: Line 97:
|rowspan="1"|
|rowspan="1"|
|Continue web construction
|Continue web construction
<br>Construct recipe filtering and recommendation system<br>
Construct recipe filtering and recommendation system
<br>Add data analysis and visualization to the website<br>
Add data analysis and visualization to the website
|-
|-


Line 109: Line 106:
|rowspan="1"|
|rowspan="1"|
|Continue web construction
|Continue web construction
<br>Add data analysis and visualization to the website<br>
Add data analysis and visualization to the website
|-  
|-  


Line 142: Line 139:
== Methods ==
== Methods ==
===Data Collection===
===Data Collection===
[[File:Screenshot from 2023-12-16 22-34-27.png|thumb|right|650px|Figure 1.Chinese Text project website pages for book "Yinshanzhengyao"]]
[[File:Screenshot from 2023-12-16 22-34-27.png|thumb|right|650px|Figure 1. Chinese Text project website pages for book "Yinshanzhengyao"]]
"Yinshanzhengyao" was published in 1330 during the Yuan dynasty, and all existing editions are derived from the Ming dynasty edition of 1456. Despite the presence of a scanned version of the book on the internet, Optical Character Recognition (OCR) poses a challenge due to the ancient Chinese text and the inclusion of illustrations. Fortunately, the Chinese Text Project (中國哲學書電子書計劃) has undertaken the noble initiative of providing open access to ancient Chinese books for both Chinese and non-Chinese scholars, resulting in the creation of a comprehensive database. Currently, it encompasses over thirty thousand books, making it the largest among historical Chinese literature databases.
"Yinshanzhengyao" was published in 1330 during the Yuan dynasty, and all existing editions are derived from the Ming dynasty edition of 1456. Despite the presence of a scanned version of the book on the internet, Optical Character Recognition (OCR) poses a challenge due to the ancient Chinese text and the inclusion of illustrations. Fortunately, the Chinese Text Project (中國哲學書電子書計劃)<ref>Donald Sturgeon, [https://ctext.org/ Chinese Text Project: a dynamic digital library of premodern Chinese], Digital Scholarship in the Humanities 2019</ref> has undertaken the noble initiative of providing open access to ancient Chinese books for both Chinese and non-Chinese scholars, resulting in the creation of a comprehensive database. Currently, it encompasses over thirty thousand books, making it the largest among historical Chinese literature databases.


"Yinshanzhengyao" is among the books included in this extensive database. Leveraging the well-defined structure of the database, we scrape data from the website. Given the project's specific focus on the recipes within the book, our data extraction is limited to the recipe content, which includes the following chapter:
"Yinshanzhengyao" is among the books included in this extensive database. Leveraging the well-defined structure of the database, we scrape data from the website. Given the project's specific focus on the recipes within the book, our data extraction is limited to the recipe content, which includes the following chapter:
Line 404: Line 401:


The text is originally in ancient Chinese, but contemporary communication predominantly uses modern Chinese. Therefore, for thorough data analysis, it is crucial to translate the recipes from ancient Chinese to modern Chinese. In our assessment, we compared the proficiency of a '''[https://huggingface.co/raynardj/wenyanwen-ancient-translate-to-modern translation model for ancient Chinese to modern Chinese]''' (Figure 2) against ChatGPT 3.5. Our findings indicate that the translations generated by ChatGPT are more fluent and closely aligned with contemporary language usage. Based on this observation, we have opted to use ChatGPT as our primary translation tool. Furthermore, since translating the Food Name and Ingredients would be meaningless, the translation will only be implemented for the Effect and Steps. Here are some examples of the translation:
The text is originally in ancient Chinese, but contemporary communication predominantly uses modern Chinese. Therefore, for thorough data analysis, it is crucial to translate the recipes from ancient Chinese to modern Chinese. In our assessment, we compared the proficiency of a '''[https://huggingface.co/raynardj/wenyanwen-ancient-translate-to-modern translation model for ancient Chinese to modern Chinese]''' (Figure 2) against ChatGPT 3.5. Our findings indicate that the translations generated by ChatGPT are more fluent and closely aligned with contemporary language usage. Based on this observation, we have opted to use ChatGPT as our primary translation tool. Furthermore, since translating the Food Name and Ingredients would be meaningless, the translation will only be implemented for the Effect and Steps. Here are some examples of the translation:


'''Ancient Chinese recipes'''
'''Ancient Chinese recipes'''
Line 472: Line 477:


==== English Translation ====
==== English Translation ====
[[File:English version.jpeg|thumb|right|650px|Figure 3. A Soup for the Qan: Chinese Dietary Medicine of the Mongol Era As Seen in Hu Sihui's Yinshan Zhengyao [1]]]
[[File:English version.jpeg|thumb|right|650px|Figure 3. A Soup for the Qan: Chinese Dietary Medicine of the Mongol Era As Seen in Hu Sihui's Yinshan Zhengyao <ref name="English_book">P. D. Buell, A Soup for the Qan: Chinese Dietary Medicine of the Mongol Era As Seen in Hu Sihui's Yinshan Zhengyao, Brill, 2000.</ref>]]
In the process of English translation, we discovered a digital document online containing the English version of the book (Figure 3, '''[https://github.com/changchuntzu0618/DH405-CookingBook/blob/main/YinShanZhengYao_english.pdf YinShanZhengYao_english.pdf]''') [1]. As a result, we extracted the English-translated recipes from this document and established an English database for the recipes. Following this, we compiled a comprehensive recipe dataset that incorporates both English and Chinese versions. For the categorization of English data, leveraging the pre-existing categorized data in Chinese, we developed a mapping method to establish a correspondence between Chinese and English categories. All tables above, containing English content, are the outcome of mapping to the Chinese dataframe generated earlier.
In the process of English translation, we discovered a digital document online containing the English version of the book (Figure 3) <ref name="English_book">P. D. Buell, A Soup for the Qan: Chinese Dietary Medicine of the Mongol Era As Seen in Hu Sihui's Yinshan Zhengyao, Brill, 2000.</ref>. As a result, we extracted the English-translated recipes from this document and established an English database for the recipes. Following this, we compiled a comprehensive recipe dataset that incorporates both English and Chinese versions. For the categorization of English data, leveraging the pre-existing categorized data in Chinese, we developed a mapping method to establish a correspondence between Chinese and English categories. All tables above, containing English content, are the outcome of mapping to the Chinese dataframe generated earlier.


=== Data Analysis ===
=== Data Analysis ===
====1.Recipe====
====1. Recipe====
According to the pie chart “distribution of recipe category” to observe the overall distribution of different kinds of recipes in the cookbook and have a general understanding of the recipes, it is found that main dishs (34.3%) and soups (25.2%) and congees (9.1%) make up the majority of the recipes.
According to the pie chart “Recipe Categories Distribution” to observe the overall distribution of different kinds of recipes in the cookbook and have a general understanding of the recipes, it is found that main dishs (34.3%) and soups (25.2%) and congees (9.1%) make up the majority of the recipes.
[[File: Recipe Categories Distribution.png|400px|center|thumb|Figure 4. Recipe Categories Distribution]]
 


====2.Ingredient====
====2. Ingredient====
Firstly, we made a word cloud to show the overall frequency of all ingredients. One notable finding involves the examination of ingredient frequency, where "Mutton" emerged as the most frequently occurring ingredient. This observation aligns with the historical context of the book, which was written and published during the Yuan dynasty, known for its Mongol leadership and renowned for mutton dishes.  
Firstly, we made a word cloud to show the overall frequency of all ingredients. One notable finding involves the examination of ingredient frequency, where "Mutton" emerged as the most frequently occurring ingredient. This observation aligns with the historical context of the book, which was written and published during the Yuan dynasty, known for its Mongol leadership and renowned for mutton dishes.  
[[File: ingredient wordcloud_en.png|800px|center|thumb|Figure 5. Ingredient Word Cloud]]


Additionally, the analysis of ingredient pairing highlighted that the combination of "Mutton" and "Tsaoko cardamom" occurs most frequently. This pairing is logical, considering that Tsaoko cardamom can help mitigate the smell of mutton.  
Additionally, the analysis of ingredient pairing highlighted that the combination of "Mutton" and "Tsaoko cardamom" occurs most frequently. This pairing is logical, considering that Tsaoko cardamom can help mitigate the smell of mutton.  
[[File: Ingredient Pairing Heatmap (frequency).png|600px|center|thumb|Figure 6. Ingredient Pairing Heatmap (frequency)]]


Furthermore, the analysis of ingredient categories revealed that "meat" is the most frequently occurring category, closely followed by Chinese medicinal materials, which aligns with the dual nature of the book as both a culinary and medical text.  
Furthermore, the analysis of ingredient categories revealed that "meat" is the most frequently occurring category, closely followed by Chinese medicinal materials, which aligns with the dual nature of the book as both a culinary and medical text.  
[[File: Ingredient Categories Distribution.png|400px|center|thumb|Figure 7. Ingredient Categories Distribution]]
[[File: Ingredients Co-occurrence Heatmap.png|600px|center|thumb|Figure 8. Ingredients Co-occurrence Heatmap]]




====3.Cooking method====
====3. Cooking method====
The most frequent cooking methods are simmer and boil, and the reason for this would be that approximately one-third of the recipes are soups and congees, which need to be simmered or boiled. Moreover, many Chinese medical materials need to be simmered for a long time in order for them to be effective.
The most frequent cooking methods are simmer and boil, and the reason for this would be that approximately one-third of the recipes are soups and congees, which need to be simmered or boiled. Moreover, many Chinese medical materials need to be simmered for a long time in order for them to be effective.
[[File: Cooking Methods.png|200px|center|thumb|Cooking Methods]]
[[File: Cooking Methods.png|600px|center|thumb|Figure 9. Cooking Methods]]




====4.Effect====
====4. Effect====
According to the distribution of effect category, the most frequent one is general health and wellness, and there are also many recipes that can help alleviate or cure specific ailments, such as gastrointestinal issues, musculoskeletal issues, neurological and mental health, and so on.
According to the distribution of effect category, the most frequent one is general health and wellness, and there are also many recipes that can help alleviate or cure specific ailments, such as gastrointestinal issues, musculoskeletal issues, neurological and mental health, and so on.
[[File: Effect Categories Distribution.png|600px|center|thumb|Figure 10. Effect Categories Distribution]]
According to the correlation analysis between ingredients and effects, it can be found that most ingredients are related to general, and some ingredients have certain specific effects, such as gastrointestinal issues or musculoskeletal issues.
[[File: Heatmap of Top Effects and Ingredients.png|600px|center|thumb|Figure 11. Heatmap of Top Effects and Ingredients]]


=== Website ===
=== Website ===
For the website, it can be divided into two main components. One is the recipe search functionality, and the other is the visualization of data analysis. We developed these two parts independently and then combined the two into a Google Sites webpage, including additional information of the cookbook. In this section, we will discuss these two components in more details.
For the website, it can be divided into two main components. One is the recipe search functionality, and the other is the visualization of data analysis. We developed these two parts independently and then combined the two into a Google Sites webpage, including additional information of the cookbook. Our website can be found in [https://sites.google.com/view/yinshanzhengyao/home Digital Chinese Cookbook Website]. In this section, we will discuss these two components in more details.


[[File:Html table.png|thumb|right|500px|Figure ?. Recipe table]]
[[File:Html table.png|thumb|right|500px|Figure 12. Recipe table]]
[[File:Final search html.png|thumb|right|500px|Figure ?. Final design for the search functionality]]
[[File:Final search html.png|thumb|right|500px|Figure 13. Final design for the search functionality]]
==== Recipe Search ====
==== Recipe Search ====
To allow user to search through the collection of recipes in the cookbook, we first construct a webpage that displays all the recipes in a HTML table with cooking method, ingredients used, and the effects associated with each entry, and the result is shown in Figure ?. Specifically, we generate a JSON file containing all the recipes, including the recipe name, the category of the dish, an array of ingredients used, an array of effects associated, cooking steps, the cooking method, and an array of effect categories. With the JSON file, we populate entries of the table dynamically when the page is loaded by templating pre-defined HTML tags in JavaScript. As for the search functionality, we include a search bar where the user can type in search text and checkboxes for ingredients, effects, etc. to filter recipes. Specifically, we incorporate a fuzzy search library, Fuse.js, which is capable of doing fuzzy match with user inputs, and we re-populate table entries with the search result. The final result is shown in Figure ?. The search bar is at the top and there are four checkbox groups in the middle. After inputting search criteria, the user can click cook button and the search result will be shown in the bottom of the page.
To allow user to search through the collection of recipes in the cookbook, we first construct a webpage that displays all the recipes in a HTML table with cooking method, ingredients used, and the effects associated with each entry, and the result is shown in Figure 12. Specifically, we generate a JSON file containing all the recipes, including the recipe name, the category of the dish, an array of ingredients used, an array of effects associated, cooking steps, the cooking method, and an array of effect categories. With the JSON file, we populate entries of the table dynamically when the page is loaded by templating pre-defined HTML tags in JavaScript. As for the search functionality, we include a search bar where the user can type in search text and checkboxes for ingredients, effects, etc. to filter recipes. Specifically, we incorporate a fuzzy search library, Fuse.js, which is capable of doing fuzzy match with user inputs, and we re-populate table entries with the search result. The final result is shown in Figure 13. The search bar is at the top and there are four checkbox groups in the middle. After inputting search criteria, the user can click cook button and the search result will be shown in the bottom of the page.


[[File:Interactive visualization.png|thumb|right|500px|Figure ?. Interactive diagram showing recipe category distribution]]
[[File:Interactive visualization.png|thumb|right|500px|Figure 14. Interactive diagram showing recipe category distribution]]
==== Analysis Visualization ====
==== Analysis Visualization ====
For visualization, we use Apache ECharts to create interactive diagrams of the data analysis result. One of the diagram is shown in Figure ?, where the user can see the number of recipes in each category when hovering over it.
For visualization, we use Apache ECharts to create interactive diagrams of the data analysis result. One of the diagrams is shown in Figure 14, where the user can see the number of recipes in each category when hovering over it.


== Limitations ==
== Limitations ==
Line 516: Line 532:
=== Website Construction:===
=== Website Construction:===
* Not all of the recipes searched for in the website can be implemented, and some of the recipes may be difficult to reproduce now due to the difficulty of obtaining some Chinese herbs, or the fact that some unique cooking methods are not applicable to modern cooking tools.
* Not all of the recipes searched for in the website can be implemented, and some of the recipes may be difficult to reproduce now due to the difficulty of obtaining some Chinese herbs, or the fact that some unique cooking methods are not applicable to modern cooking tools.
* The website could be further improved, e.g. by linking some parts of the interactive charts to the corresponding detailed informationdetails.
* The website could be further improved, e.g. by linking some parts of the interactive charts to the corresponding detailed information.


== Outlook ==
== Outlook ==
Line 531: Line 547:
== Links ==
== Links ==
- '''[https://github.com/changchuntzu0618/DH405-CookingBook GitHub]'''
- '''[https://github.com/changchuntzu0618/DH405-CookingBook GitHub]'''
- '''[https://sites.google.com/view/yinshanzhengyao/home Digital Chinese Cookbook Website]'''
== References ==

Latest revision as of 20:55, 19 December 2023

Introduction

Food is an integral part of Chinese culture. Many things in Chinese culture revolve around food. Different occasions are associated with different cuisines, and different parts of China have developed over time their own distinctive cuisines.

Yinshanzhengyao (飲膳正要), a culinary manuscript published in 1330 during the Yuan dynasty, remains a significant historical document with all existing editions tracing their roots back to the Ming dynasty edition of 1456. Remarkably, it stands as one of the oldest extant dietary manuscripts, providing a fascinating glimpse into the culinary practices of ancient China. The detailed records contained within its pages offer a unique window into the daily lives and gastronomic preferences of individuals during the Yuan dynasty.

What sets Yinshanzhengyao apart is its incorporation of traditional Chinese beliefs linking specific ingredients and foods to distinct attributes. This aspect adds an intriguing layer to the manuscript, as it underscores the cultural significance of food beyond mere sustenance. In Chinese culture, the consumption of particular foods is believed to have therapeutic benefits, aiding in the treatment of specific ailments or promoting longevity. This perspective on the interplay between diet and well-being is a distinctive feature not commonly found in Western culinary traditions.

Therefore, we would like to digitize this cookbook in this project making it more accessible to more people around the world.

For this project, there are two objectives:

  • Perform data analysis for the recipes in the cookbook which would hopefully help us better understand how Chinese cuisines evolved over time and quantify the relationship between ingredients and medical effects
  • Develop a dedicated webpage which display recipes from the cookbook and users of the website can browse these recipes and search recipes with selected ingredients and medical effects

Deliverables

  1. Digitized recipes from the cookbook: One csv file containing recipe name, ingredients and cooking steps in Chinese and English
  2. Categorized ingredients, effects, cooking methods, and cuisine categories: One csv file for each category
  3. Website: One webpage displaying recipe entries and figures of data analysis with search functionality
  4. Wiki: One wiki page providing an introduction and comprehensive description of the entire project
  5. Github: One Github repository to showcase all codes and technical aspects of the project

Project Plan and Milestones

Weekly Project Plan

Week Data Collection Data Processing Data Analysis Web Construction
Week 3 Search historical Chinese cookbooks and compare them
Week 4 Choose one historical Chinese cookbook

Select the chapter to work on

Week 5 Get data from the website First clean and sort the data

Construct the dataset of recipes Find Ancient Chinese to Modern Chinese translation model

Week 6 Construct the dataset of ingredients

Translating from Ancient Chinese to Modern Chinese

Week 7 Categorize data
Week 8 Data Analyse: category, ingredient, cooking method, and effect Start web construction
Week 9 Data Analyse: ingredient and ingredient category pairing Continue web construction
Week 10 Data Analyse: effect and ingredient correlation Continue web construction

Construct recipe filtering and recommendation system

Week 11 Modren Chinese to English translation Continue web construction

Construct recipe filtering and recommendation system Add data analysis and visualization to the website

Week 12 Modren Chinese to English translation Continue web construction

Add data analysis and visualization to the website

Week 13 Finalize and improve the website
Week 14 Prepare the Wikipedia page & final presentation

Milestone 1

  • Prepare a project proposal and the goal and objective of the project
  • Get Chinese cooking book data from the website

Milestone 2

  • Clean the data and construct the datasets for the Chinese cooking book
  • Translate from Ancient Chinese and Modern Chinese
  • Categorize the data depending on ingredient, effect, category, and cooking method

Milestone 3

  • Data Analysis
  • Web construction and recipe filtering and recommendation system
  • Prepare final presentation and Wikipedia page

Methods

Data Collection

Figure 1. Chinese Text project website pages for book "Yinshanzhengyao"

"Yinshanzhengyao" was published in 1330 during the Yuan dynasty, and all existing editions are derived from the Ming dynasty edition of 1456. Despite the presence of a scanned version of the book on the internet, Optical Character Recognition (OCR) poses a challenge due to the ancient Chinese text and the inclusion of illustrations. Fortunately, the Chinese Text Project (中國哲學書電子書計劃)[1] has undertaken the noble initiative of providing open access to ancient Chinese books for both Chinese and non-Chinese scholars, resulting in the creation of a comprehensive database. Currently, it encompasses over thirty thousand books, making it the largest among historical Chinese literature databases.

"Yinshanzhengyao" is among the books included in this extensive database. Leveraging the well-defined structure of the database, we scrape data from the website. Given the project's specific focus on the recipes within the book, our data extraction is limited to the recipe content, which includes the following chapter:

  • Strange Delicacies of Combined Flavours 1, 2, 3
  • Various Hot Beverages and Concentrates
  • Foods that Cure Various Illnesses

In total, there are 210 recipes, each accompanied by information on its effects, ingredients with quantities, and step-by-step instructions. As a medical text, the "effect" refers to the benefits of the food and precautions to be taken, providing valuable insights into the medicinal properties of the recipes.

Data Processing

Construct dataset

Upon acquiring data from the website, the imperative task is to clean and structure the data into the following format: Food_Name, Effect, Ingredients, Steps. However, due to the website not well separating these four pieces of information, we developed functions to customarily construct this dataframe. Below are examples of recipe dataframes.

Food_Name_en Effect_en Ingredients_en Steps_en Food_Name Effect Ingredients Steps
Ghee Liquor It cures asthenia and removes wind-wetness. Ghee (one bowl). Mix ingredient with a cup of liquor and drink warm. It is proven effective. 醍醐酒 治虚弱,去风湿。 醍醐 一 盏 上件,以酒一杯和匀,温饮之,效验。
Lamb Honey Paste It treats xulao diseases, waist pain (lumbago), coughing, withered lung, and hectic fever due to yin deficiency. Cooked sheep’s fat (five liang), cooked sheep’s marrow (five liang), crystallized honey (five liang; refine), juice of sprouting ginger (one he), juice of sprouting Chinese foxglove (one he). [Of] ingredients, first decoct the sheep’s fat and bring to a boil. Then add the sheep’s marrow. Bring to a boil again, then add the honey and [sprouting] Chinese foxglove and sprouting ginger juice. Stir constantly. Slowly simmer and bring repeatedly to a boil over a small fire to make a paste. Take a spoonful dissolved in warm liquor every day on an empty stomach. Or make it into a soup or a congee and eat it. This is also acceptable. 羊蜜膏 治虚劳,腰痛,咳嗽,肺痿,骨蒸。 熟羊脂 五两 熟羊髓 五两 白沙蜜 五两,炼净 生姜汁 一合 生地黄汁 五合 右五味,先以羊脂煎令沸,次下羊髓又令沸,次下蜜、地黄、生姜汁,不住手搅,微火熬数沸成膏。每日空心温酒调一匙头。或作羹汤,或作粥食之亦可。
Deer Head Soup It supplements and increases, controls polydipsia, and cures ache of foot and knee. Deer’s head [and] hooves (one set; remove hair and clean; bone and divide into pieces). For the ingredients, take a large chunk of kasni, grind up into a mush and apply evenly to deer head, [and] hoof meat. Fry both the [marinated] head and hoof meat in 4 liang of vegetable oil [“Muslim lesser oil”]. Quench roasted head and hoof meat in boiling water, 28 boil until soft. Add 3 qian of black pepper, 2 qian of kasni, 1 qian of long pepper [Piper longum], 1 cup of cow’s milk, 1 he of juice of sprouting ginger. Adjust flavors with a little salt. [Variation:] In one method, use deer’s tail to obtain broth. Add ground ginger. Adjust flavors with salt. 鹿头汤 补益,止烦渴,治脚膝疼痛。 鹿头蹄 一副,退洗净,卸作块 上件,用哈昔泥豆子大,研如泥,与鹿头蹄肉同拌匀,用回回小油四两同炒,入滚水熬令软,下胡椒三钱,哈昔泥二钱,荜拨一钱,牛奶子一盏,生姜汁一合,盐少许,调和。一法用鹿尾取汁,入姜末、盐,同调和。
Sprouting Chinese Foxglove Chicken It treats pain of the back and loins, deficiency and injury of bone and marrow, inability to stand upright for long periods, heaviness of body and qi shortage, night sweating and lack of appetite, and occasional vomiting and dysentery. Sprouting Chinese foxglove (half a jin), sweetmeats (five liang), and black chicken (one). [Of the] ingredients first take the chicken, pluck, remove the giblets and clean. Cut up finely. Combine the Chinese foxglove and the sugar together evenly. Put the mixture inside the intestinal cavity of the chicken. Put it into a copper pot. Then put the copper pot into a cauldron and steam. When the dish has been cooked completely, remove the chicken and eat. Do not use salt or vinegar. Eat the meat. When it is gone also drink the broth. 生地黄鸡 治腰背疼痛,骨髓虚损,不能久立,身重气乏,盗汗,少食,时复吐利。 生地黄 半斤 饴糖 五两 乌鸡 一 枚 右三味,先将鸡去毛、肠肚净,细切,地黄与糖相和匀,内鸡腹中,以铜器中放之,复置甑中蒸炊,饭熟成,取食之。不用盐醋,唯食肉尽却饮汁。
Pig Kidney Congee It cures kidney xulao damage, debility and ache of waist and knee. Pig kidney (one, remove fatty tissue and slice), non-glutinous rice (three ho), tsaoko cardamom (three), prepared mandarin orange peel (one qian; remove white), grain-of-paradise (two qian). [Of] ingredients, first take the pig kidney, the prepared mandarin orange peel etc. and boil to make a juice. Strain and remove the dregs. Add a small amount of liquor. Then add the rice to make a congee. Eat on an empty stomach. 猪肾粥 治肾虚劳损,腰膝无力,疼痛。 猪肾 一对,去脂膜,切 粳米 三合 草果 二钱 陈皮 一钱,去白 缩砂 二钱 上件,先将猪肾、陈皮等煮成汁,滤去滓,入酒少许,次下米成粥,空心食之。

Categorize

To facilitate further data analysis and implement the search function for the website, the initial step involves categorizing our data. This categorization encompasses 15 recipe categories, 10 cooking methods, 13 ingredient categories, and 9 effect categories. The detailed categories are as follows:

  • Recipe categories: 'Paste', 'Pan-fry', 'Dish', 'Thick soup', 'Conge', 'Meat', 'Soup', 'Noodles', 'Rice noodles', 'Pancake', 'Thick liquid', 'Oil', 'Tea', 'Wonton', 'Steamed bun'
Category_en Food_Name_en Category Food_Name
Pancake Cow’s Milk Buns 牛奶子烧饼
Dish Boiled Sheep’s Breast 菜品 熬羊胸子
Steamed bun Eggplant Manta 馒头 茄子馒头
Soup Carp Soup 鲤鱼汤
Tea Jade Mortar Tea 玉磨茶
  • Cooking methods: 'Boil', 'Simmer', 'Steam', 'Pan-fry', 'Bake', 'Braise', 'Broil', 'Stir-fry', 'Roast', 'Deep-fry'
Method_en Food_Name_en Method Food_Name
Boil Bream Gruel 鲫鱼羹
Simmer Qima Congee 乞马粥
Steam Sheep’s Head Hash 羊头脍
Pan-fry Cherry [Prunus pseudocerasus] Concentrate 樱桃煎
Bake Dried Beef 牛肉脯
Braise Turmeric[–Colored] Fish 姜黄鱼
Broil Broiled Sheep’s Heart 炙羊心
Stir-fry Cotton Rose–[Petal] Chicken 芙蓉鸡
Roast Roast Wild Goose (Roast Cormorant and Roast Duck are the same) 烧雁
Deep-fry Scalded Jasa’a (a delicacy) 炸䐑儿
  • Ingredient categories: 'Chinese Medicinal Material', 'Plant', 'Spice', 'Fruit', 'Vegetable', 'Seafood', 'Meat', 'Dairy Product', 'Grain', 'Juice', 'Condiment', 'Tea', 'Other'
Ingredient_en Category Ingredient
ginseng chinese_medicinal_material 人参
Purple perilla leaf plant 紫苏叶
tsaoko cardamom spice 草果
Cherries fruit 樱桃
Chinese radish vegetable 萝卜
  • Effect categories:'Gastrointestinal Issues', 'Neurological and Mental Health', 'General Health and Wellness', 'Musculoskeletal Issues', 'Speech-related', 'Heat-clearing', 'Genitourinary Issues', 'Respiratory Issues', 'Others'
Effect_en Category Effect
stop thirst cure cough Gastrointestinal Issues 生津止渴
this cures apoplexy Neurological and Mental Health 治中风
augments qi General Health and Wellness 益气和中
the medullae strengthens sinew and bone Musculoskeletal Issues 壮筋骨
obstruction of the large intestine Speech-related 语言蹇涩
cures heat of the center Heat-clearing 治中热

The following presents five examples of recipes along with their all categorized information.

Recipe_name Category Cooking Method Effect Category Ingredient Category
Sprouting Chinese Foxglove Chicken Dish 'Steam' 'Musculoskeletal Issues', 'General Health and Wellness' 'meat', 'condiment', 'chinese_medicinal_material'
Carp Soup Soup 'Braise', 'Boil' 'Gastrointestinal Issues', 'Genitourinary Issues', 'Others' 'seafood' 'spice' 'plant'
Oil Rape Shoots Broth Thick soup 'Simmer' 'General Health and Wellness' 'spice' 'meat'
Barley Samsa Noodles Rice noodles 'Stir-fry', 'Simmer' 'General Health and Wellness', 'Gastrointestinal Issues' 'plant' 'meat'
Sheep Bone Congee Conge Simmer' 'General Health and Wellness', 'Musculoskeletal Issues' 'condiment' 'spice' 'plant'

Translation: Ancient Chinese to Modern Chinese

Figure 2. Ancient Chinese to Modern Chinese model

The text is originally in ancient Chinese, but contemporary communication predominantly uses modern Chinese. Therefore, for thorough data analysis, it is crucial to translate the recipes from ancient Chinese to modern Chinese. In our assessment, we compared the proficiency of a translation model for ancient Chinese to modern Chinese (Figure 2) against ChatGPT 3.5. Our findings indicate that the translations generated by ChatGPT are more fluent and closely aligned with contemporary language usage. Based on this observation, we have opted to use ChatGPT as our primary translation tool. Furthermore, since translating the Food Name and Ingredients would be meaningless, the translation will only be implemented for the Effect and Steps. Here are some examples of the translation:





Ancient Chinese recipes

Food_Name Effect Ingredients Steps
醍醐酒 治虚弱,去风湿。 醍醐 一 盏 上件,以酒一杯和匀,温饮之,效验。
羊蜜膏 治虚劳,腰痛,咳嗽,肺痿,骨蒸。 熟羊脂 五两 熟羊髓 五两 白沙蜜 五两,炼净 生姜汁 一合 生地黄汁 五合 右五味,先以羊脂煎令沸,次下羊髓又令沸,次下蜜、地黄、生姜汁,不住手搅,微火熬数沸成膏。每日空心温酒调一匙头。或作羹汤,或作粥食之亦可。
鹿头汤 补益,止烦渴,治脚膝疼痛。 鹿头蹄 一副,退洗净,卸作块 上件,用哈昔泥豆子大,研如泥,与鹿头蹄肉同拌匀,用回回小油四两同炒,入滚水熬令软,下胡椒三钱,哈昔泥二钱,荜拨一钱,牛奶子一盏,生姜汁一合,盐少许,调和。一法用鹿尾取汁,入姜末、盐,同调和。
生地黄鸡 治腰背疼痛,骨髓虚损,不能久立,身重气乏,盗汗,少食,时复吐利。 生地黄 半斤 饴糖 五两 乌鸡 一 枚 右三味,先将鸡去毛、肠肚净,细切,地黄与糖相和匀,内鸡腹中,以铜器中放之,复置甑中蒸炊,饭熟成,取食之。不用盐醋,唯食肉尽却饮汁。
猪肾粥 治肾虚劳损,腰膝无力,疼痛。 猪肾 一对,去脂膜,切 粳米 三合 草果 二钱 陈皮 一钱,去白 缩砂 二钱 上件,先将猪肾、陈皮等煮成汁,滤去滓,入酒少许,次下米成粥,空心食之。

Modern Chinese recipes

Food_Name Effect Ingredients Steps
醍醐酒 用于治疗虚弱、风湿。 醍醐 一 盏 用一杯酒和匀,温热饮用,具有特定效果。
羊蜜膏 用于治疗虚弱、腰痛、咳嗽、肺痿和骨髓虚蒸。 熟羊脂 五两 熟羊髓 五两 白沙蜜 五两,炼净 生姜汁 一合 生地黄汁 五合 五种食材,首先用羊脂煎热,然后加入羊髓,再次加热。接着加入蜜、地黄和生姜汁,不停搅拌,用小火熬煮数次,直到成为膏状。每天空腹温酒,加入一勺膏头。可以做成羹汤,也可以做成粥来食用。
鹿头汤 补养身体,缓解烦躁口渴,治疗脚膝疼痛。 鹿头蹄 一副,退洗净,卸作块 上述食材,将哈昔泥研成泥状,与鹿头蹄肉一同拌匀,再用回回小油4两炒,加入滚水煮至软烂,再加入胡椒3钱、哈昔泥2钱、荜拨1钱、牛奶子1盏、生姜汁1合,少许盐,搅拌均匀。另一种方法是用鹿尾提取汁,然后加入姜末和少许盐,搅拌均匀。
生地黄鸡 用于治疗腰背疼痛、骨髓虚损、不能久立、身体沉重、精力不足、盗汗、食欲不振、时常呕吐和腹泻。 生地黄 半斤 饴糖 五两 乌鸡 一 枚 三种食材,首先将鸡去毛,清理肠胃,切成细块。将地黄与糖混合均匀,然后放入鸡的腹中,放在铜器中,再置于甑中蒸煮,直到饭熟。然后取出食用,无需加盐和醋,只吃掉肉,不饮下汤。
猪肾粥 用于治疗肾虚劳损、腰膝疼痛。 猪肾 一对,去脂膜,切 粳米 三合 草果 二钱 陈皮 一钱,去白 缩砂 二钱 首先将猪肾和陈皮煮成汁,去除杂质,加入少量酒,然后加入大米煮成粥,空腹食用。

English Translation

Figure 3. A Soup for the Qan: Chinese Dietary Medicine of the Mongol Era As Seen in Hu Sihui's Yinshan Zhengyao [2]

In the process of English translation, we discovered a digital document online containing the English version of the book (Figure 3) [2]. As a result, we extracted the English-translated recipes from this document and established an English database for the recipes. Following this, we compiled a comprehensive recipe dataset that incorporates both English and Chinese versions. For the categorization of English data, leveraging the pre-existing categorized data in Chinese, we developed a mapping method to establish a correspondence between Chinese and English categories. All tables above, containing English content, are the outcome of mapping to the Chinese dataframe generated earlier.

Data Analysis

1. Recipe

According to the pie chart “Recipe Categories Distribution” to observe the overall distribution of different kinds of recipes in the cookbook and have a general understanding of the recipes, it is found that main dishs (34.3%) and soups (25.2%) and congees (9.1%) make up the majority of the recipes.

Figure 4. Recipe Categories Distribution


2. Ingredient

Firstly, we made a word cloud to show the overall frequency of all ingredients. One notable finding involves the examination of ingredient frequency, where "Mutton" emerged as the most frequently occurring ingredient. This observation aligns with the historical context of the book, which was written and published during the Yuan dynasty, known for its Mongol leadership and renowned for mutton dishes.

Figure 5. Ingredient Word Cloud

Additionally, the analysis of ingredient pairing highlighted that the combination of "Mutton" and "Tsaoko cardamom" occurs most frequently. This pairing is logical, considering that Tsaoko cardamom can help mitigate the smell of mutton.

Figure 6. Ingredient Pairing Heatmap (frequency)

Furthermore, the analysis of ingredient categories revealed that "meat" is the most frequently occurring category, closely followed by Chinese medicinal materials, which aligns with the dual nature of the book as both a culinary and medical text.

Figure 7. Ingredient Categories Distribution
Figure 8. Ingredients Co-occurrence Heatmap


3. Cooking method

The most frequent cooking methods are simmer and boil, and the reason for this would be that approximately one-third of the recipes are soups and congees, which need to be simmered or boiled. Moreover, many Chinese medical materials need to be simmered for a long time in order for them to be effective.

Figure 9. Cooking Methods


4. Effect

According to the distribution of effect category, the most frequent one is general health and wellness, and there are also many recipes that can help alleviate or cure specific ailments, such as gastrointestinal issues, musculoskeletal issues, neurological and mental health, and so on.

Figure 10. Effect Categories Distribution


According to the correlation analysis between ingredients and effects, it can be found that most ingredients are related to general, and some ingredients have certain specific effects, such as gastrointestinal issues or musculoskeletal issues.

Figure 11. Heatmap of Top Effects and Ingredients

Website

For the website, it can be divided into two main components. One is the recipe search functionality, and the other is the visualization of data analysis. We developed these two parts independently and then combined the two into a Google Sites webpage, including additional information of the cookbook. Our website can be found in Digital Chinese Cookbook Website. In this section, we will discuss these two components in more details.

Figure 12. Recipe table
Figure 13. Final design for the search functionality

Recipe Search

To allow user to search through the collection of recipes in the cookbook, we first construct a webpage that displays all the recipes in a HTML table with cooking method, ingredients used, and the effects associated with each entry, and the result is shown in Figure 12. Specifically, we generate a JSON file containing all the recipes, including the recipe name, the category of the dish, an array of ingredients used, an array of effects associated, cooking steps, the cooking method, and an array of effect categories. With the JSON file, we populate entries of the table dynamically when the page is loaded by templating pre-defined HTML tags in JavaScript. As for the search functionality, we include a search bar where the user can type in search text and checkboxes for ingredients, effects, etc. to filter recipes. Specifically, we incorporate a fuzzy search library, Fuse.js, which is capable of doing fuzzy match with user inputs, and we re-populate table entries with the search result. The final result is shown in Figure 13. The search bar is at the top and there are four checkbox groups in the middle. After inputting search criteria, the user can click cook button and the search result will be shown in the bottom of the page.

Figure 14. Interactive diagram showing recipe category distribution

Analysis Visualization

For visualization, we use Apache ECharts to create interactive diagrams of the data analysis result. One of the diagrams is shown in Figure 14, where the user can see the number of recipes in each category when hovering over it.

Limitations

Data processing:

  • Some of the data in the recipes were not fully utilized in the data analysis, such as the amount of ingredients.
  • Some of the steps in the data processing were handled manually without a proper processing model, which makes it difficult to apply to other large datasets.
  • Only some broad categories were defined about the efficacy of the dishes, which could be connected with Chinese medicine for more specific categorization and interesting analysis.
  • There are some problems in translating ancient Chinese into modern Chinese or English, and it may be difficult to realize an English translation of all the content without an English version of this cookbook.

Website Construction:

  • Not all of the recipes searched for in the website can be implemented, and some of the recipes may be difficult to reproduce now due to the difficulty of obtaining some Chinese herbs, or the fact that some unique cooking methods are not applicable to modern cooking tools.
  • The website could be further improved, e.g. by linking some parts of the interactive charts to the corresponding detailed information.

Outlook

  • There could be more interesting angles of data analysis, but they are difficult to realize. For example, historical analysis of recipes, exploring which recipes or ingredients are lost, is difficult to accurately verify due to limited knowledge of the subject and the fact that many of the herbs themselves are very uncommon.
  • There are other chapters in the cookbook that cover various ingredients and their properties and efficacy, so in the future the recipes can be analyzed in more depth by combining other data from the book.
  • Make further improvements to the content and functionality of the website. Link sections in the visualization charts to the corresponding recipe details; improve the search function, e.g. by displaying the corresponding number of recipes in the options bar.
  • If the website can be widely used, a community could be created where users can exchange experiences of cooking according to recipes, or improving ancient recipes with present-day ingredients, as well as different insights into recipes based on different cultural contexts.

Broader research in the cultural field

  • It would be interesting to learn more about the origins and development of the recipe, analyze the eating habits of the people at that time, and use this to explore the customs of the people's lives in the context of more of the recipe's historical, regional, and other cultural backgrounds.
  • If possible, collect more information about the recipes and compare them with recipes from different dynasties, different regions of China, or even different countries during the same period.
  • Connect with Chinese medicine and Chinese culture to trace the development of ancient Chinese medicine and explore the mysterious Chinese culture.

Links

- GitHub

- Digital Chinese Cookbook Website

References

  1. Donald Sturgeon, Chinese Text Project: a dynamic digital library of premodern Chinese, Digital Scholarship in the Humanities 2019
  2. 2.0 2.1 P. D. Buell, A Soup for the Qan: Chinese Dietary Medicine of the Mongol Era As Seen in Hu Sihui's Yinshan Zhengyao, Brill, 2000.