File size: 23,127 Bytes
edfb009 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 |
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "bab83122-6939-4366-8a44-17cf9d96621e",
"metadata": {},
"outputs": [],
"source": [
"import xml.etree.ElementTree as ET\n",
"import re\n",
"import os\n",
"import json"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "29e40ec8-5ed8-458f-b071-07c4a1d88ffb",
"metadata": {},
"outputs": [],
"source": [
"cleaned_data = []\n",
"cleaned_test_data = []"
]
},
{
"cell_type": "markdown",
"id": "2c03b036-edc1-4e40-9f43-36a5ccbcc787",
"metadata": {},
"source": [
"# FUNCTION TO CLEAN DATA FILES IN SPECIFIC DIRECTORIES"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "44c5a2ac-3e10-439d-8c0c-65bff7ce4c9f",
"metadata": {},
"outputs": [],
"source": [
"def clean_data(summary_path : str, bill_path : str):\n",
" sums_path = summary_path\n",
" bills_path = bill_path\n",
" \n",
" # GETTING A LIST OF THE FILE NAMES FOR THE SUMMARY DATA FILES\n",
" sums_dir_list = []\n",
" for x in os.listdir(sums_path):\n",
" if x.endswith(\".xml\"):\n",
" sums_dir_list.append(x)\n",
" sums_dir_list = sorted(sums_dir_list)\n",
"\n",
" # GETTING A LIST OF THE FILE NAMES FOR THE BILL DATA FILES\n",
" bills_dir_list = []\n",
" for x in os.listdir(bills_path):\n",
" if x.endswith(\".xml\"):\n",
" bills_dir_list.append(x)\n",
" bills_dir_list = sorted(bills_dir_list)\n",
" \n",
" for i in range(len(sums_dir_list)):\n",
" # SUMMARY\n",
" summary_texts = []\n",
" sum_path = sums_path + sums_dir_list[i]\n",
" tree_sum = ET.parse(sum_path)\n",
" root_sum = tree_sum.getroot()\n",
" for description in root_sum.iter('summary-text'):\n",
" temp = description.text\n",
" temp = re.sub('<[^>]+>', '', temp)\n",
" temp = re.sub('\\s+', ' ', temp)\n",
" temp = re.sub('^[\\s]+', '', temp)\n",
" temp = re.sub('[\\s]+$', '', temp)\n",
" summary_texts.append(str(temp))\n",
" summary = summary_texts[0]\n",
" \n",
" # TITLE\n",
" title = \"\"\n",
" for title in root_sum.iter(\"title\"):\n",
" title = title.text\n",
" \n",
" # BILL\n",
" bill_path = bills_path + bills_dir_list[i]\n",
" tree_bill = ET.parse(sum_path)\n",
" root_bill = tree_bill.getroot()\n",
" bill = \"\"\n",
" for child in root_bill.iter():\n",
" temp = child.text\n",
" bill = bill + temp + \" \"\n",
" bill = re.sub('<[^>]+>', '', bill)\n",
" bill = re.sub('\\s+', ' ', bill)\n",
" bill = re.sub('^[\\s]+', '', bill)\n",
" bill = re.sub('[\\s]+$', '', bill)\n",
" \n",
" # MERGE TO LIST OF DICTIONARIES\n",
" cleaned_data.append({\"summary\" : summary, \"text\" : bill, \"title\" : title})"
]
},
{
"cell_type": "markdown",
"id": "d70c8e1a-39e5-46af-a72d-5f979272c70f",
"metadata": {},
"source": [
"# CALLING CLEAN DATA FUNCTION ON ALL DATA FOLDERS"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7524db26-7e8e-4bd7-ac0a-36223d51abb5",
"metadata": {},
"outputs": [],
"source": [
"clean_data(\"./data/sums/117/\", \"./data/bills/117\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f6afd2a1-88a9-4fc0-892c-0c928a1a65af",
"metadata": {},
"outputs": [],
"source": [
"clean_data(\"./data/sums/116/\", \"./data/bills/116\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "23a9ff4b-bf53-4e62-a356-909b464687bb",
"metadata": {},
"outputs": [],
"source": [
"clean_data(\"./data/sums/115/\", \"./data/bills/115\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "501757e3-ae60-494e-a9dc-f9eeee1b997f",
"metadata": {},
"outputs": [],
"source": [
"clean_data(\"./data/sums/114/\", \"./data/bills/114\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ca133591-0acc-427a-9c5d-dd8e8a530828",
"metadata": {},
"outputs": [],
"source": [
"clean_data(\"./data/sums/113/\", \"./data/bills/113\")"
]
},
{
"cell_type": "markdown",
"id": "95a2be9e-5bc6-47f8-8183-c415c8f2a5d8",
"metadata": {},
"source": [
"# CHECKING FOR CORRECT LENGTH AND SPOT CHECKING DATA"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7db890e9-86bc-49bf-a278-f6d13277f6fb",
"metadata": {},
"outputs": [],
"source": [
"len(cleaned_data)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5119d34d-fc3a-49a6-ac1a-ac2f293a6829",
"metadata": {},
"outputs": [],
"source": [
"cleaned_data[19]"
]
},
{
"cell_type": "markdown",
"id": "a8fe2092-2bed-4f50-bf80-934cdb4b7cac",
"metadata": {},
"source": [
"# SAVING CLEANED DATA AS JSON FILE TO TRANSFER TO TEMU"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "12605fea-ea7a-43d4-9ed0-92bd7192d879",
"metadata": {},
"outputs": [],
"source": [
"# Convert and write JSON object to file\n",
"with open(\"cleaned_bill_sum_data.json\", \"w\") as outfile: \n",
" json.dump(cleaned_data, outfile)"
]
},
{
"cell_type": "markdown",
"id": "1770d5e7-0970-44c2-8472-1494fc6c8d9d",
"metadata": {},
"source": [
"# IMPORTING CLEANED DATA JSON FILE TO A LIST OF DICTIONARIES"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7f890296-f09d-4590-a8d8-1489b07a1a34",
"metadata": {},
"outputs": [],
"source": [
"# Opening JSON file\n",
"with open(\"cleaned_bill_sum_data.json\") as json_file:\n",
" cleaned_data = json.load(json_file)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2d561958-5795-446d-9104-57012635db0b",
"metadata": {},
"outputs": [],
"source": [
"# import datasets\n",
"# from datasets import load_dataset\n",
"# import pandas as pd\n",
"# from datasets import Dataset"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c3eaa971-2f84-4962-912b-b0cee8147ae3",
"metadata": {},
"outputs": [],
"source": [
"# data = pd.DataFrame.from_dict(cleaned_data)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "8397087c-9a2a-4fa1-8d79-7915b8c2d13b",
"metadata": {},
"outputs": [],
"source": [
"# dataset = Dataset.from_pandas(pd.DataFrame(data=data))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "91e76f1d-2602-4270-84e5-7663446c79b2",
"metadata": {},
"outputs": [],
"source": [
"# billsum = dataset.train_test_split(test_size=0.2)"
]
},
{
"cell_type": "markdown",
"id": "a2e80fe5-56fa-4803-9657-76e42cd9eeab",
"metadata": {},
"source": [
"# FUNCTION TO CLEAN THE TEST DATA"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1bb9a98f-913e-42d2-8bac-a8504f8d2013",
"metadata": {},
"outputs": [],
"source": [
"def clean_test_data(summary_path : str, bill_path : str):\n",
" sums_path = summary_path\n",
" bills_path = bill_path\n",
" \n",
" # GETTING A LIST OF THE FILE NAMES FOR THE SUMMARY DATA FILES\n",
" sums_dir_list = []\n",
" for x in os.listdir(sums_path):\n",
" if x.endswith(\".xml\"):\n",
" sums_dir_list.append(x)\n",
" sums_dir_list = sorted(sums_dir_list)\n",
"\n",
" # GETTING A LIST OF THE FILE NAMES FOR THE BILL DATA FILES\n",
" bills_dir_list = []\n",
" for x in os.listdir(bills_path):\n",
" if x.endswith(\".xml\"):\n",
" bills_dir_list.append(x)\n",
" bills_dir_list = sorted(bills_dir_list)\n",
" \n",
" for i in range(len(sums_dir_list)):\n",
" # SUMMARY\n",
" summary_texts = []\n",
" sum_path = sums_path + sums_dir_list[i]\n",
" tree_sum = ET.parse(sum_path)\n",
" root_sum = tree_sum.getroot()\n",
" for description in root_sum.iter('summary-text'):\n",
" temp = description.text\n",
" temp = re.sub('<[^>]+>', '', temp)\n",
" temp = re.sub('\\s+', ' ', temp)\n",
" temp = re.sub('^[\\s]+', '', temp)\n",
" temp = re.sub('[\\s]+$', '', temp)\n",
" summary_texts.append(str(temp))\n",
" summary = summary_texts[0]\n",
" \n",
" # TITLE\n",
" title = \"\"\n",
" for title in root_sum.iter(\"title\"):\n",
" title = title.text\n",
" \n",
" # BILL\n",
" bill_path = bills_path + bills_dir_list[i]\n",
" tree_bill = ET.parse(sum_path)\n",
" root_bill = tree_bill.getroot()\n",
" bill = \"\"\n",
" for child in root_bill.iter():\n",
" temp = child.text\n",
" bill = bill + temp + \" \"\n",
" bill = re.sub('<[^>]+>', '', bill)\n",
" bill = re.sub('\\s+', ' ', bill)\n",
" bill = re.sub('^[\\s]+', '', bill)\n",
" bill = re.sub('[\\s]+$', '', bill)\n",
" \n",
" # MERGE TO LIST OF DICTIONARIES\n",
" cleaned_test_data.append({\"summary\" : summary, \"text\" : bill, \"title\" : title})"
]
},
{
"cell_type": "markdown",
"id": "fe641226-2779-4de1-8066-1b65abde1a21",
"metadata": {},
"source": [
"# CALLING FUNCTION TO CLEAN THE TEST DATA"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "342881ed-cd6d-4be0-9e1e-ca402d9b57af",
"metadata": {},
"outputs": [],
"source": [
"clean_test_data(\"./data/test/sums/\", \"./data/test/bills/\")"
]
},
{
"cell_type": "markdown",
"id": "f276dd3a-76f0-4e19-a9d3-59ea94fae58a",
"metadata": {},
"source": [
"# SHOWING A SAMPLE OF THE TEST DATA"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ded519a6-dcd8-4399-b415-384cd609bdf0",
"metadata": {},
"outputs": [],
"source": [
"cleaned_test_data[11]"
]
},
{
"cell_type": "markdown",
"id": "f3d07f33-bd77-43dc-9ea6-20a1eb1d4314",
"metadata": {},
"source": [
"# SAVING CLEANED TEST DATA TO JSON"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1fc0a1c7-47a6-4b06-a47f-de77c7cc41df",
"metadata": {},
"outputs": [],
"source": [
"# Convert and write JSON object to file\n",
"with open(\"cleaned_bill_sum_test_data.json\", \"w\") as outfile: \n",
" json.dump(cleaned_test_data, outfile)"
]
},
{
"cell_type": "markdown",
"id": "8ed577e6-e553-4ad8-8ddc-5ec3acb7f982",
"metadata": {},
"source": [
"# LOADING CLEANED TEST DATA"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "254f3c2b-4d95-4c0e-8487-43cd2ea0f4be",
"metadata": {},
"outputs": [],
"source": [
"# Opening JSON file\n",
"with open(\"cleaned_bill_sum_test_data.json\") as json_file:\n",
" cleaned_test_data = json.load(json_file)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "34054ada-c930-478d-866b-d1a6bc1ed241",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "926c806f-a3c4-4c86-a655-949e9c33da8f",
"metadata": {},
"source": [
"# SINGLE FILE CLEANING"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "a7205466-3b57-4f31-a61e-00023e23db2e",
"metadata": {},
"outputs": [],
"source": [
"new_cleaned_test_data = []"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "e28bcda9-0dc5-46ba-ac90-05096e32b331",
"metadata": {},
"outputs": [],
"source": [
"def single_file_cleaning(summary : str, bill : str):\n",
" sum_path = summary\n",
" bill_path = bill\n",
" \n",
" # SUMMARY\n",
" summary_texts = []\n",
" # sum_path = sums_path + sums_dir_list[i]\n",
" tree_sum = ET.parse(sum_path)\n",
" root_sum = tree_sum.getroot()\n",
" for description in root_sum.iter('summary-text'):\n",
" temp = description.text\n",
" temp = re.sub('<[^>]+>', '', temp)\n",
" temp = re.sub('\\s+', ' ', temp)\n",
" temp = re.sub('^[\\s]+', '', temp)\n",
" temp = re.sub('[\\s]+$', '', temp)\n",
" summary_texts.append(str(temp))\n",
" summary = summary_texts[0]\n",
" \n",
" # TITLE\n",
" title = \"\"\n",
" for title in root_sum.iter(\"title\"):\n",
" title = title.text\n",
" \n",
" # BILL\n",
" # bill_path = bills_path + bills_dir_list[i]\n",
" tree_bill = ET.parse(sum_path)\n",
" root_bill = tree_bill.getroot()\n",
" bill = \"\"\n",
" for child in root_bill.iter():\n",
" temp = child.text\n",
" bill = bill + temp + \" \"\n",
" bill = re.sub('<[^>]+>', '', bill)\n",
" bill = re.sub('\\s+', ' ', bill)\n",
" bill = re.sub('^[\\s]+', '', bill)\n",
" bill = re.sub('[\\s]+$', '', bill)\n",
" \n",
" # MERGE TO LIST OF DICTIONARIES\n",
" new_cleaned_test_data.append({\"summary\" : summary, \"text\" : bill, \"title\" : title})"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "ccfd78ec-3d57-4459-badb-824ca3092c4c",
"metadata": {},
"outputs": [],
"source": [
"single_file_cleaning(\"./BILLSUM-118s1000.xml\", \"./BILLS-118s1000is.xml\")"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "3ef2cd68-7f37-4025-bf06-821c49c18932",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[{'summary': 'Saving Access to Laboratory Services Act This bill modifies provisions relating to Medicare payment rates for clinical diagnostic laboratory services, including by requiring payment rates for certain widely available clinical diagnostic laboratory tests to be based on a statistical sampling of private sector rates.',\n",
" 'text': 'Saving Access to Laboratory Services Act 2023-03-28 Introduced in Senate Saving Access to Laboratory Services Act This bill modifies provisions relating to Medicare payment rates for clinical diagnostic laboratory services, including by requiring payment rates for certain widely available clinical diagnostic laboratory tests to be based on a statistical sampling of private sector rates. text/xml EN Pursuant to Title 17 Section 105 of the United States Code, this file is not subject to copyright protection and is in the public domain. Congressional Research Service, Library of Congress This file contains bill summaries for federal legislation. A bill summary describes the most significant provisions of a piece of legislation and details the effects the legislative text may have on current law and federal programs. Bill summaries are authored by the Congressional Research Service (CRS) of the Library of Congress. As stated in Public Law 91-510 (2 USC 166 (d)(6)), one of the duties of CRS is \"to prepare summaries and digests of bills and resolutions of a public general nature introduced in the Senate or House of Representatives\". For more information, refer to the User Guide that accompanies this file.',\n",
" 'title': 'Saving Access to Laboratory Services Act'}]"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"new_cleaned_test_data"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "510b26bf-afff-44b8-ba3e-516445d98379",
"metadata": {},
"outputs": [],
"source": [
"single_file_cleaning(\"./BILLSUM-118s1016.xml\", \"./BILLS-118s1016is.xml\")"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "1d5ceac2-0fa7-4ddf-b8d5-888ffd51b754",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[{'summary': 'Saving Access to Laboratory Services Act This bill modifies provisions relating to Medicare payment rates for clinical diagnostic laboratory services, including by requiring payment rates for certain widely available clinical diagnostic laboratory tests to be based on a statistical sampling of private sector rates.',\n",
" 'text': 'Saving Access to Laboratory Services Act 2023-03-28 Introduced in Senate Saving Access to Laboratory Services Act This bill modifies provisions relating to Medicare payment rates for clinical diagnostic laboratory services, including by requiring payment rates for certain widely available clinical diagnostic laboratory tests to be based on a statistical sampling of private sector rates. text/xml EN Pursuant to Title 17 Section 105 of the United States Code, this file is not subject to copyright protection and is in the public domain. Congressional Research Service, Library of Congress This file contains bill summaries for federal legislation. A bill summary describes the most significant provisions of a piece of legislation and details the effects the legislative text may have on current law and federal programs. Bill summaries are authored by the Congressional Research Service (CRS) of the Library of Congress. As stated in Public Law 91-510 (2 USC 166 (d)(6)), one of the duties of CRS is \"to prepare summaries and digests of bills and resolutions of a public general nature introduced in the Senate or House of Representatives\". For more information, refer to the User Guide that accompanies this file.',\n",
" 'title': 'Saving Access to Laboratory Services Act'},\n",
" {'summary': 'Agriculture Resilience Act of 2023 This bill establishes, expands, and revises multiple programs and activities of the Department of Agriculture (USDA) primarily to reduce carbon emissions from the agriculture sector. Specifically, USDA must finalize and implement a plan to achieve net-zero emissions from the sector by 2040. USDA must periodically review and revise the plan, as necessary, and annually report on its implementation. Additionally, the bill expands the scope of various USDA research, extension, and education programs; conservation programs; and livestock programs to incorporate climate change adaptation and mitigation. Expanded activities include efforts to improve soil health and preserve farmland and grassland. Further, the bill changes programs that support renewable energy in rural areas to address carbon emissions in the agriculture sector. Among these changes, the bill provides statutory authority for the AgSTAR program for reducing methane emissions from livestock waste and requires the program to be moved from the Environmental Protection Agency to USDA. The bill also addresses food waste, for example, by (1) standardizing the voluntary labels used by food producers to indicate the date by which food should be used or discarded, and (2) making composting activities eligible for support through USDA conservation programs. Moreover, the bill establishes grants to reduce and prevent food waste in landfills and in schools.',\n",
" 'text': 'Agriculture Resilience Act of 2023 2023-03-28 Introduced in Senate Agriculture Resilience Act of 2023 This bill establishes, expands, and revises multiple programs and activities of the Department of Agriculture (USDA) primarily to reduce carbon emissions from the agriculture sector. Specifically, USDA must finalize and implement a plan to achieve net-zero emissions from the sector by 2040. USDA must periodically review and revise the plan, as necessary, and annually report on its implementation. Additionally, the bill expands the scope of various USDA research, extension, and education programs; conservation programs; and livestock programs to incorporate climate change adaptation and mitigation. Expanded activities include efforts to improve soil health and preserve farmland and grassland. Further, the bill changes programs that support renewable energy in rural areas to address carbon emissions in the agriculture sector. Among these changes, the bill provides statutory authority for the AgSTAR program for reducing methane emissions from livestock waste and requires the program to be moved from the Environmental Protection Agency to USDA. The bill also addresses food waste, for example, by (1) standardizing the voluntary labels used by food producers to indicate the date by which food should be used or discarded, and (2) making composting activities eligible for support through USDA conservation programs. Moreover, the bill establishes grants to reduce and prevent food waste in landfills and in schools. text/xml EN Pursuant to Title 17 Section 105 of the United States Code, this file is not subject to copyright protection and is in the public domain. Congressional Research Service, Library of Congress This file contains bill summaries for federal legislation. A bill summary describes the most significant provisions of a piece of legislation and details the effects the legislative text may have on current law and federal programs. Bill summaries are authored by the Congressional Research Service (CRS) of the Library of Congress. As stated in Public Law 91-510 (2 USC 166 (d)(6)), one of the duties of CRS is \"to prepare summaries and digests of bills and resolutions of a public general nature introduced in the Senate or House of Representatives\". For more information, refer to the User Guide that accompanies this file.',\n",
" 'title': 'Agriculture Resilience Act of 2023'}]"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"new_cleaned_test_data"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "0d1ce846-892c-4856-b45f-aeaa4d2cbc33",
"metadata": {},
"outputs": [],
"source": [
"# Convert and write JSON object to file\n",
"with open(\"new_cleaned_bill_sum_test_data.json\", \"w\") as outfile: \n",
" json.dump(new_cleaned_test_data, outfile)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0f8c6a5f-2c4d-4f99-ab42-e258ac13701b",
"metadata": {},
"outputs": [],
"source": []
}
],
"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.11.7"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
|