Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def extract(url:str, html:str) -> str:
try:
nlp_md = extract_content_from_html_with_magic_html(url, html)
# or mm_nlp_md = extract_content_from_html_with_magic_html(url, html, 'mm_md')
# or mm_nlp_md = extract_content_from_html_with_magic_html(url, html, 'mm_md', use_raw_image_url=True)
# or nlp_md = extract_content_from_html_with_magic_html(url, html, language='zh')
return nlp_md
except Exception as e:
Expand Down Expand Up @@ -124,6 +125,7 @@ def extract(url:str, html:str) -> str:
try:
nlp_md = extract_content_from_main_html(url, html)
# or mm_nlp_md = extract_content_from_main_html(url, html, 'mm_md')
# or mm_nlp_md = extract_content_from_main_html(url, html, 'mm_md', use_raw_image_url=True)
# or nlp_md = extract_content_from_main_html(url, html, language='zh')
return nlp_md
except Exception as e:
Expand Down
178 changes: 41 additions & 137 deletions jupyter/layout-clustering/layout.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,8 @@
{
"cell_type": "code",
"execution_count": null,
"id": "6a86ea9b-beca-4324-b101-5684b3ed0955",
"metadata": {
"execution": {
"iopub.execute_input": "2025-09-18T07:59:54.207430Z",
"iopub.status.busy": "2025-09-18T07:59:54.207141Z",
"iopub.status.idle": "2025-09-18T07:59:58.189455Z",
"shell.execute_reply": "2025-09-18T07:59:58.188614Z",
"shell.execute_reply.started": "2025-09-18T07:59:54.207413Z"
}
},
"id": "0",
"metadata": {},
"outputs": [],
"source": [
"# 加载spark配置\n",
Expand Down Expand Up @@ -53,7 +45,7 @@
},
{
"cell_type": "markdown",
"id": "a927594f-071f-4ba2-b884-73d5389fcd12",
"id": "1",
"metadata": {},
"source": [
"# utils"
Expand All @@ -62,16 +54,8 @@
{
"cell_type": "code",
"execution_count": null,
"id": "dc262e56-2da9-4462-94d4-b2917054eed2",
"metadata": {
"execution": {
"iopub.execute_input": "2025-09-18T07:59:58.190425Z",
"iopub.status.busy": "2025-09-18T07:59:58.190101Z",
"iopub.status.idle": "2025-09-18T07:59:58.197584Z",
"shell.execute_reply": "2025-09-18T07:59:58.197218Z",
"shell.execute_reply.started": "2025-09-18T07:59:58.190407Z"
}
},
"id": "2",
"metadata": {},
"outputs": [],
"source": [
"def create_spark(spark_name: str):\n",
Expand Down Expand Up @@ -134,15 +118,15 @@
},
{
"cell_type": "markdown",
"id": "120df5bb-c23b-4629-8722-dc6ad661aa31",
"id": "3",
"metadata": {},
"source": [
"# choose_domain"
]
},
{
"cell_type": "markdown",
"id": "59be7dbc-12b7-4fce-8e6e-37da745e0689",
"id": "4",
"metadata": {},
"source": [
"## utils"
Expand All @@ -151,16 +135,8 @@
{
"cell_type": "code",
"execution_count": null,
"id": "42775d11-03a0-4a7d-808d-f6c1297f46a6",
"metadata": {
"execution": {
"iopub.execute_input": "2025-09-18T07:59:58.198289Z",
"iopub.status.busy": "2025-09-18T07:59:58.198011Z",
"iopub.status.idle": "2025-09-18T07:59:58.207870Z",
"shell.execute_reply": "2025-09-18T07:59:58.207498Z",
"shell.execute_reply.started": "2025-09-18T07:59:58.198275Z"
}
},
"id": "5",
"metadata": {},
"outputs": [],
"source": [
"def divide_list_to_chunks(values, n_chunks):\n",
Expand Down Expand Up @@ -201,7 +177,7 @@
},
{
"cell_type": "markdown",
"id": "6b97e89b-7ef3-46f9-b3e9-8041ba9f8a77",
"id": "6",
"metadata": {},
"source": [
"## choose domain"
Expand All @@ -210,16 +186,8 @@
{
"cell_type": "code",
"execution_count": null,
"id": "8cb041bd-5fff-4bc5-901b-94b539d71e5b",
"metadata": {
"execution": {
"iopub.execute_input": "2025-09-18T07:59:58.208498Z",
"iopub.status.busy": "2025-09-18T07:59:58.208321Z",
"iopub.status.idle": "2025-09-18T07:59:58.221785Z",
"shell.execute_reply": "2025-09-18T07:59:58.221424Z",
"shell.execute_reply.started": "2025-09-18T07:59:58.208484Z"
}
},
"id": "7",
"metadata": {},
"outputs": [],
"source": [
"def get_choose_input_path(INPUT_PATH):\n",
Expand Down Expand Up @@ -295,15 +263,15 @@
},
{
"cell_type": "markdown",
"id": "79554e66-6acf-4135-a85d-a48ec6da2cd4",
"id": "8",
"metadata": {},
"source": [
"# cluster_layout"
]
},
{
"cell_type": "markdown",
"id": "27be3e17-f695-4bef-a401-3ae14a7164bf",
"id": "9",
"metadata": {},
"source": [
"## utils"
Expand All @@ -312,16 +280,8 @@
{
"cell_type": "code",
"execution_count": null,
"id": "d13b494b-eb53-46f7-a1eb-4a264032365a",
"metadata": {
"execution": {
"iopub.execute_input": "2025-09-18T07:59:58.222485Z",
"iopub.status.busy": "2025-09-18T07:59:58.222287Z",
"iopub.status.idle": "2025-09-18T07:59:58.245952Z",
"shell.execute_reply": "2025-09-18T07:59:58.245591Z",
"shell.execute_reply.started": "2025-09-18T07:59:58.222471Z"
}
},
"id": "10",
"metadata": {},
"outputs": [],
"source": [
"def get_all_domain_data_cluster(_iter):\n",
Expand Down Expand Up @@ -576,7 +536,7 @@
},
{
"cell_type": "markdown",
"id": "6425f161-df4f-4f1c-a64a-bf2f4bd9be6a",
"id": "11",
"metadata": {},
"source": [
"## main func"
Expand All @@ -585,16 +545,8 @@
{
"cell_type": "code",
"execution_count": null,
"id": "3755fc47-8a51-4986-a2bb-bf7b9f0ace1f",
"metadata": {
"execution": {
"iopub.execute_input": "2025-09-18T07:59:58.247462Z",
"iopub.status.busy": "2025-09-18T07:59:58.247318Z",
"iopub.status.idle": "2025-09-18T07:59:58.261509Z",
"shell.execute_reply": "2025-09-18T07:59:58.261152Z",
"shell.execute_reply.started": "2025-09-18T07:59:58.247448Z"
}
},
"id": "12",
"metadata": {},
"outputs": [],
"source": [
"# get data by domain\n",
Expand Down Expand Up @@ -715,15 +667,15 @@
},
{
"cell_type": "markdown",
"id": "d822db16-fdae-4273-8589-aa8d761b5065",
"id": "13",
"metadata": {},
"source": [
"# cluster_layout_little"
]
},
{
"cell_type": "markdown",
"id": "49c74424-9d34-4335-9264-a651f60eaf70",
"id": "14",
"metadata": {},
"source": [
"## utils"
Expand All @@ -732,16 +684,8 @@
{
"cell_type": "code",
"execution_count": null,
"id": "e0d67976-6609-415d-91b0-a815d756f02d",
"metadata": {
"execution": {
"iopub.execute_input": "2025-09-18T07:59:58.262281Z",
"iopub.status.busy": "2025-09-18T07:59:58.262011Z",
"iopub.status.idle": "2025-09-18T07:59:58.281355Z",
"shell.execute_reply": "2025-09-18T07:59:58.281002Z",
"shell.execute_reply.started": "2025-09-18T07:59:58.262267Z"
}
},
"id": "15",
"metadata": {},
"outputs": [],
"source": [
"def get_all_domain_data_cluster_little(_iter):\n",
Expand Down Expand Up @@ -978,7 +922,7 @@
},
{
"cell_type": "markdown",
"id": "c144e52c-e5e8-4e77-80e0-8273686d4e41",
"id": "16",
"metadata": {},
"source": [
"## main func"
Expand All @@ -987,16 +931,8 @@
{
"cell_type": "code",
"execution_count": null,
"id": "21af9fd9-5e3b-43af-b8ac-e72cb8490fe2",
"metadata": {
"execution": {
"iopub.execute_input": "2025-09-18T07:59:58.282086Z",
"iopub.status.busy": "2025-09-18T07:59:58.281819Z",
"iopub.status.idle": "2025-09-18T07:59:58.299944Z",
"shell.execute_reply": "2025-09-18T07:59:58.299582Z",
"shell.execute_reply.started": "2025-09-18T07:59:58.282072Z"
}
},
"id": "17",
"metadata": {},
"outputs": [],
"source": [
"# get data by domain\n",
Expand Down Expand Up @@ -1106,15 +1042,15 @@
},
{
"cell_type": "markdown",
"id": "259adf4f-536e-446c-8506-71d374484e35",
"id": "18",
"metadata": {},
"source": [
"# layout_sim"
]
},
{
"cell_type": "markdown",
"id": "86fbcebc-535e-4ce0-8b8c-530e305e5cc4",
"id": "19",
"metadata": {},
"source": [
"## utils"
Expand All @@ -1123,16 +1059,8 @@
{
"cell_type": "code",
"execution_count": null,
"id": "0e5b9273-a0f6-4b6b-95f8-0c4f2e2ac1b6",
"metadata": {
"execution": {
"iopub.execute_input": "2025-09-18T07:59:58.300664Z",
"iopub.status.busy": "2025-09-18T07:59:58.300397Z",
"iopub.status.idle": "2025-09-18T07:59:58.317025Z",
"shell.execute_reply": "2025-09-18T07:59:58.316662Z",
"shell.execute_reply.started": "2025-09-18T07:59:58.300651Z"
}
},
"id": "20",
"metadata": {},
"outputs": [],
"source": [
"def parse_output_data(row_data):\n",
Expand Down Expand Up @@ -1266,7 +1194,7 @@
},
{
"cell_type": "markdown",
"id": "a671eac7-50d8-470e-94ca-b6b1a0c0dbab",
"id": "21",
"metadata": {},
"source": [
"## main func"
Expand All @@ -1275,16 +1203,8 @@
{
"cell_type": "code",
"execution_count": null,
"id": "c3fc5958-8f1e-42b4-888d-a33c75ba400a",
"metadata": {
"execution": {
"iopub.execute_input": "2025-09-18T07:59:58.317612Z",
"iopub.status.busy": "2025-09-18T07:59:58.317438Z",
"iopub.status.idle": "2025-09-18T07:59:58.329846Z",
"shell.execute_reply": "2025-09-18T07:59:58.329496Z",
"shell.execute_reply.started": "2025-09-18T07:59:58.317598Z"
}
},
"id": "22",
"metadata": {},
"outputs": [],
"source": [
"def parse_input_path_sim(input_path):\n",
Expand Down Expand Up @@ -1340,15 +1260,15 @@
},
{
"cell_type": "markdown",
"id": "ade51c83-a9e4-42dd-886b-e6e50be49812",
"id": "23",
"metadata": {},
"source": [
"# layout_index"
]
},
{
"cell_type": "markdown",
"id": "32afc659-8ba0-4b27-9483-021c3621ca7e",
"id": "24",
"metadata": {},
"source": [
"## main func"
Expand All @@ -1357,16 +1277,8 @@
{
"cell_type": "code",
"execution_count": null,
"id": "e4c65c62-10cc-440d-984a-e469ceb47565",
"metadata": {
"execution": {
"iopub.execute_input": "2025-09-18T07:59:58.330481Z",
"iopub.status.busy": "2025-09-18T07:59:58.330284Z",
"iopub.status.idle": "2025-09-18T07:59:58.350105Z",
"shell.execute_reply": "2025-09-18T07:59:58.349761Z",
"shell.execute_reply.started": "2025-09-18T07:59:58.330467Z"
}
},
"id": "25",
"metadata": {},
"outputs": [],
"source": [
"def parse_input_path_index(input_path: str):\n",
Expand Down Expand Up @@ -1450,7 +1362,7 @@
},
{
"cell_type": "markdown",
"id": "dd1b5390-1639-4ed7-862f-00774c53c3ff",
"id": "26",
"metadata": {},
"source": [
"# start"
Expand All @@ -1459,16 +1371,8 @@
{
"cell_type": "code",
"execution_count": null,
"id": "bd1317ee-93f6-4148-b836-4eb630d44f12",
"metadata": {
"execution": {
"iopub.execute_input": "2025-09-18T07:59:58.350784Z",
"iopub.status.busy": "2025-09-18T07:59:58.350505Z",
"iopub.status.idle": "2025-09-19T01:34:02.031014Z",
"shell.execute_reply": "2025-09-19T01:34:02.030302Z",
"shell.execute_reply.started": "2025-09-18T07:59:58.350770Z"
}
},
"id": "27",
"metadata": {},
"outputs": [],
"source": [
"choose_main()\n",
Expand All @@ -1490,7 +1394,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "3460c9dd-b6a8-451c-be1e-1c03cd6705a7",
"id": "28",
"metadata": {},
"outputs": [],
"source": []
Expand Down
Loading
Loading