You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
384 lines
11 KiB
Plaintext
384 lines
11 KiB
Plaintext
2 years ago
|
{
|
||
|
"cells": [
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "59b5e56e-137c-4c72-8832-3fb7e625fddc",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"# a longan tree\n",
|
||
|
"# 龙眼树"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "1d3d5765-21b5-4022-8fb6-995feadbd000",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## what is longan?\n",
|
||
|
"Dimocarpus longan, commonly known as the longan, is a tropical tree species that produces edible fruit. It is one of the better-known tropical members of the soapberry family Sapindaceae,to which the lychee and rambutan also belong. The fruit of the longan is similar to that of the lychee, but less aromatic in taste."
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "8bd7458b-bbb1-4977-9f78-a4f8f2e93985",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### a photo of a longan tree with fruits\n",
|
||
|
"from reddit post https://www.reddit.com/r/gardening/comments/8cfh6n/our_glorious_longan_tree/"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 1,
|
||
|
"id": "39a00b5f-45ca-4356-ad0e-b2cef2593ef1",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"data": {
|
||
|
"text/html": [
|
||
|
"<img src=\"images/longan_tree.jpg\" width=\"400\" height=\"400\"/>"
|
||
|
],
|
||
|
"text/plain": [
|
||
|
"<IPython.core.display.Image object>"
|
||
|
]
|
||
|
},
|
||
|
"execution_count": 1,
|
||
|
"metadata": {},
|
||
|
"output_type": "execute_result"
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"from IPython.display import Image\n",
|
||
|
"url_tree = \"images/longan_tree.jpg\"\n",
|
||
|
"Image(url= url_tree, width=400, height=400)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "547e4b39-856f-4374-a23a-b95917817749",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## what is the soapberry family Sapindaceae?\n",
|
||
|
"The Sapindaceae are a family of flowering plants in the order Sapindales known as the soapberry family. \n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "9a0050aa-eabb-4407-971e-abd89f9ddb17",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"### why is knowing the soapberry family important for the longan tree"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "68ba1fba-d0f0-4e6f-952b-07ae19262df8",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"As we know the longan tree is one tree species under the soapberry family, we can track the other tree species relevant to the longan tree. The lychee tree, the rambutan tree, and the longan tree are closely related to each other. "
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "0af3e49f-f417-4779-afc8-9932be9539f5",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"This is written in early spring, and longan fruits are harvested during the summer. In villages in Southern China, harvesting longan fruits \"摘龙眼\"is a fun summer activity. "
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "7ba8cd22-532f-424c-8c57-96990a8903fd",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"Longan also means \"dragon eye\". The fruit is round, resembling an eyeball of a dragon. There is also the \"phoenix eye\"(凤眼),referring to eyes that has a long-ish shape and tilts upwards. "
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "3f133efd-1adf-40f0-acb6-24fbff03bebb",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"In a gender binary context, suppose there is a pair of twins that's a boy and a girl. In Chinese such pair of twins is refered to as \"dragon and phoenix twin\"(龙凤胎)。Suppose the girl has the \"phonenix eyes\"(凤眼), then would the boy eat loads of \"dragon eyes\"(龙眼)?!\n",
|
||
|
"在性别二元对立的语境下,有一对龙凤胎,女孩有一双凤眼,那男孩岂不是有一双龙眼?!"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 23,
|
||
|
"id": "23f11815-0327-4027-8e4a-6004595e9525",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"eyes_l = [\"⊙\",\"ಠ\",\"ಡ\",\"⚆\",\n",
|
||
|
" \"✪\",\"◙\",\"*\",\"°\",\n",
|
||
|
" \"☉\",\"⚈\",\"๏\",\"◔\",\n",
|
||
|
" \"◉\",\"ʘ\",\"Θ\",\"❍\",\n",
|
||
|
" \"●\",\"ᓂ\",\"ᓀ\",\"•͈\",\n",
|
||
|
" ]"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "e9181f99-311b-4788-bba1-3781b62dc7f8",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"## dragon eyes of various affects\n",
|
||
|
"呆萌的龙眼,迟疑的龙眼,左顾右盼的龙眼,闪烁其辞的龙眼。\n",
|
||
|
"被踩扁的龙眼,爆了浆的龙眼,剥开皮的龙眼,被掏空的龙眼。"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 24,
|
||
|
"id": "f74f4027-9305-4862-adb9-3bd46bae37ad",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"# build a tree from eyes_l\n",
|
||
|
"# can try a binary tree structure\n",
|
||
|
"# however, a longan tree cannot be arbitrarily defined as using\n",
|
||
|
"# the bst structure\n",
|
||
|
"# are there other tree branching structures to try? "
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 25,
|
||
|
"id": "35a275f8-71d4-4354-b019-befc9650c042",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"# starting from a yard of trees: longan, lychee and rombutan "
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 26,
|
||
|
"id": "fe8cc549-0ffe-4d55-afb3-a49605fca2c1",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"soapberry forest\n",
|
||
|
"├── longan\n",
|
||
|
"├── lychee\n",
|
||
|
"└── rombutan\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"from anytree import Node, RenderTree\n",
|
||
|
"# build tree\n",
|
||
|
"soapberryForest = Node(\"soapberry forest\")\n",
|
||
|
"longan = Node(\"longan\", parent=soapberryForest)\n",
|
||
|
"lychee = Node(\"lychee\", parent=soapberryForest)\n",
|
||
|
"rombutan = Node(\"rombutan\", parent=soapberryForest)\n",
|
||
|
"\n",
|
||
|
"# print tree\n",
|
||
|
"for pre, fill, node in RenderTree(soapberryForest):\n",
|
||
|
"\tprint(\"%s%s\" %(pre,node.name))"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 27,
|
||
|
"id": "a651378f-02e3-4da4-8510-3754af471cc2",
|
||
|
"metadata": {},
|
||
|
"outputs": [],
|
||
|
"source": [
|
||
|
"# bst tree template \n",
|
||
|
"\"\"\"Python3 program to demonstrate insert\n",
|
||
|
"operation in binary search tree \"\"\"\n",
|
||
|
"\n",
|
||
|
"# A Binary Tree Node\n",
|
||
|
"# Utility function to create a\n",
|
||
|
"# new tree node\n",
|
||
|
"class newNode:\n",
|
||
|
"\n",
|
||
|
" # Constructor to create a newNode\n",
|
||
|
" def __init__(self, data):\n",
|
||
|
" self.key= data\n",
|
||
|
" self.left = None\n",
|
||
|
" self.right = self.parent = None\n",
|
||
|
"\n",
|
||
|
"# A utility function to insert a new\n",
|
||
|
"# Node with given key in BST\n",
|
||
|
"def insert(root, key):\n",
|
||
|
"\n",
|
||
|
" # Create a new Node containing\n",
|
||
|
" # the new element\n",
|
||
|
" newnode = newNode(key)\n",
|
||
|
"\n",
|
||
|
" # Pointer to start traversing from root\n",
|
||
|
" # and traverses downward path to search\n",
|
||
|
" # where the new node to be inserted\n",
|
||
|
" x = root\n",
|
||
|
"\n",
|
||
|
" # Pointer y maintains the trailing\n",
|
||
|
" # pointer of x\n",
|
||
|
" y = None\n",
|
||
|
"\n",
|
||
|
" while (x != None):\n",
|
||
|
" y = x\n",
|
||
|
" if (key < x.key):\n",
|
||
|
" x = x.left\n",
|
||
|
" else:\n",
|
||
|
" x = x.right\n",
|
||
|
" \n",
|
||
|
" # If the root is None i.e the tree is\n",
|
||
|
" # empty. The new node is the root node\n",
|
||
|
" if (y == None):\n",
|
||
|
" y = newnode\n",
|
||
|
"\n",
|
||
|
" # If the new key is less then the leaf node key\n",
|
||
|
" # Assign the new node to be its left child\n",
|
||
|
" elif (key < y.key):\n",
|
||
|
" y.left = newnode\n",
|
||
|
"\n",
|
||
|
" # else assign the new node its\n",
|
||
|
" # right child\n",
|
||
|
" else:\n",
|
||
|
" y.right = newnode\n",
|
||
|
"\n",
|
||
|
" # Returns the pointer where the\n",
|
||
|
" # new node is inserted\n",
|
||
|
" return y\n",
|
||
|
"\n",
|
||
|
"#Driver Code\n",
|
||
|
"if __name__ == '__main__':\n",
|
||
|
"\n",
|
||
|
" root = None\n",
|
||
|
" root = insert(root, \"longan tree\")\n",
|
||
|
" for eye in eyes_l:\n",
|
||
|
" insert(root,eye)\n",
|
||
|
"\n"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "code",
|
||
|
"execution_count": 28,
|
||
|
"id": "ef3979c3-7da9-4bb3-a691-4a210da308cb",
|
||
|
"metadata": {},
|
||
|
"outputs": [
|
||
|
{
|
||
|
"name": "stdout",
|
||
|
"output_type": "stream",
|
||
|
"text": [
|
||
|
"\n",
|
||
|
" ❍\n",
|
||
|
"\n",
|
||
|
" ✪\n",
|
||
|
"\n",
|
||
|
" ⚈\n",
|
||
|
"\n",
|
||
|
" ⚆\n",
|
||
|
"\n",
|
||
|
" ☉\n",
|
||
|
"\n",
|
||
|
" ◙\n",
|
||
|
"\n",
|
||
|
" ◔\n",
|
||
|
"\n",
|
||
|
" ●\n",
|
||
|
"\n",
|
||
|
" ◉\n",
|
||
|
"\n",
|
||
|
" ⊙\n",
|
||
|
"\n",
|
||
|
" •͈\n",
|
||
|
"\n",
|
||
|
" ᓂ\n",
|
||
|
"\n",
|
||
|
" ᓀ\n",
|
||
|
"\n",
|
||
|
" ๏\n",
|
||
|
"\n",
|
||
|
" ಡ\n",
|
||
|
"\n",
|
||
|
" ಠ\n",
|
||
|
"\n",
|
||
|
" Θ\n",
|
||
|
"\n",
|
||
|
" ʘ\n",
|
||
|
"\n",
|
||
|
" °\n",
|
||
|
"\n",
|
||
|
"longan tree\n",
|
||
|
"\n",
|
||
|
" *\n"
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"source": [
|
||
|
"COUNT = [10]\n",
|
||
|
"def print2DUtil(root, space) :\n",
|
||
|
"\n",
|
||
|
" # Base case\n",
|
||
|
" if (root == None) :\n",
|
||
|
" return\n",
|
||
|
"\n",
|
||
|
" # Increase distance between levels\n",
|
||
|
" space += COUNT[0]\n",
|
||
|
"\n",
|
||
|
" # Process right child first\n",
|
||
|
" print2DUtil(root.right, space)\n",
|
||
|
"\n",
|
||
|
" # Print current node after space\n",
|
||
|
" # count\n",
|
||
|
" print()\n",
|
||
|
" for i in range(COUNT[0], space):\n",
|
||
|
" print(end = \" \")\n",
|
||
|
" print(root.key)\n",
|
||
|
"\n",
|
||
|
" # Process left child\n",
|
||
|
" print2DUtil(root.left, space)\n",
|
||
|
"\n",
|
||
|
"# Wrapper over print2DUtil()\n",
|
||
|
"def print2D(root) :\n",
|
||
|
" \n",
|
||
|
" # space=[0]\n",
|
||
|
" # Pass initial space count as 0\n",
|
||
|
" print2DUtil(root, 0)\n",
|
||
|
"\n",
|
||
|
"# Driver Code\n",
|
||
|
"if __name__ == '__main__':\n",
|
||
|
"\n",
|
||
|
" \n",
|
||
|
" print2D(root)"
|
||
|
]
|
||
|
},
|
||
|
{
|
||
|
"cell_type": "markdown",
|
||
|
"id": "d8d8b5fa-49cf-47e5-8c69-a0285b286030",
|
||
|
"metadata": {},
|
||
|
"source": [
|
||
|
"a pun, a poem, a puoem. "
|
||
|
]
|
||
|
}
|
||
|
],
|
||
|
"metadata": {
|
||
|
"kernelspec": {
|
||
|
"display_name": "Python 3 (ipykernel)",
|
||
|
"language": "python",
|
||
|
"name": "python3"
|
||
|
},
|
||
|
"language_info": {
|
||
|
"codemirror_mode": {
|
||
|
"name": "ipython",
|
||
|
"version": 3
|
||
|
},
|
||
|
"file_extension": ".py",
|
||
|
"mimetype": "text/x-python",
|
||
|
"name": "python",
|
||
|
"nbconvert_exporter": "python",
|
||
|
"pygments_lexer": "ipython3",
|
||
|
"version": "3.9.7"
|
||
|
}
|
||
|
},
|
||
|
"nbformat": 4,
|
||
|
"nbformat_minor": 5
|
||
|
}
|