From 25856e1392859ab8352f42b38c180f8343ade769 Mon Sep 17 00:00:00 2001 From: Nikhil Khandelwal Date: Thu, 15 May 2025 00:26:57 +0530 Subject: [PATCH] Added Custom Serializer for Table enrichment Signed-off-by: Nikhil Khandelwal --- docs/examples/serialization.ipynb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/examples/serialization.ipynb b/docs/examples/serialization.ipynb index af882e9f..d297a78a 100644 --- a/docs/examples/serialization.ipynb +++ b/docs/examples/serialization.ipynb @@ -479,7 +479,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -528,7 +528,7 @@ " # appending annotations:\n", " for annotation in item.annotations:\n", " if isinstance(annotation, PictureDescriptionData):\n", - " text_parts.append(f\"\")\n", + " text_parts.append(f\"{item.self_ref}\\n\")\n", "\n", " text_res = (separator or \"\\n\").join(text_parts)\n", " return create_ser_result(text=text_res, span_source=item)" @@ -684,7 +684,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 13, "metadata": {}, "outputs": [], "source": [ @@ -733,7 +733,7 @@ " # appending annotations:\n", " for annotation in item.annotations:\n", " if isinstance(annotation, PictureDescriptionData):\n", - " text_parts.append(f\"\\n\")\n", + " text_parts.append(f\"\\n{item.self_ref}\\n\")\n", "\n", " text_res = (separator or \"\\n\").join(text_parts)\n", " return create_ser_result(text=text_res, span_source=item)" @@ -741,7 +741,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 14, "metadata": {}, "outputs": [ { @@ -759,6 +759,7 @@ "│ | Starbucks 2022 | What was the total energy con- sumption in 2021? | According to the table, the total energy consumption in 2021 was 2,491,543 MWh. | │\n", "│ | Starbucks 2022 | How much packaging material was made from renewable mate- rials? | According to the given data, 31% of packaging materials were made from recycled or renewable materials in FY22. | │\n", "│ │\n", + "│ #/tables/0 │\n", "│ <!-- Table description: The image is a bar chart that shows the number of hours spent on employee learning in 2021. The x-axis represents the number of hours, ranging from 0 to 22.5 million, while the │\n", "│ y-axis represents the number of hours, ranging from 0 to 22.5 million. The chart shows that the number of hours spent on employee learning increased from 2021 to 2022, with the highest number of hours spent │\n", "│ on employee learning in 2022. │\n", @@ -805,6 +806,7 @@ "│ | Starbucks 2022 | What was the total energy con- sumption in 2021? | According to the table, the total energy consumption in 2021 was 2,491,543 MWh. | │\n", "│ | Starbucks 2022 | How much packaging material was made from renewable mate- rials? | According to the given data, 31% of packaging materials were made from recycled or renewable materials in FY22. | │\n", "│ │\n", + "│ #/tables/0 │\n", "│