Datasets:
File size: 23,059 Bytes
bd2366b 192f2c0 bd2366b 192f2c0 bd2366b 192f2c0 bd2366b d2d505b bd2366b 9ab2868 d2d505b 192f2c0 d2d505b 192f2c0 d2d505b 192f2c0 d2d505b 9ab2868 bd2366b 192f2c0 bd2366b 192f2c0 bd2366b 192f2c0 bd2366b 192f2c0 bd2366b 192f2c0 bd2366b 192f2c0 bd2366b 192f2c0 bd2366b 192f2c0 bd2366b 192f2c0 bd2366b 192f2c0 bd2366b 192f2c0 bd2366b 192f2c0 bd2366b 192f2c0 bd2366b d2d505b bd2366b 192f2c0 9ab2868 d2d505b 9ab2868 d2d505b 192f2c0 d2d505b 192f2c0 d2d505b 192f2c0 9ab2868 d2d505b 9ab2868 d2d505b bd2366b c0395cb bd2366b c0395cb bd2366b c0395cb bd2366b 9ab2868 bd2366b |
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 |
{
"cells": [
{
"cell_type": "code",
"execution_count": 10,
"id": "3c6f4757-0572-48ec-8159-206bbf2e08fd",
"metadata": {},
"outputs": [],
"source": [
"from datasets import load_dataset"
]
},
{
"cell_type": "markdown",
"id": "27e4d6d8-b201-482b-9b0a-688e1a21c9c0",
"metadata": {},
"source": [
"# Load `questions`"
]
},
{
"cell_type": "code",
"execution_count": 28,
"id": "2cb75e7c-b7eb-4601-85f3-cc27c1f5ff94",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Downloading builder script: 100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 3.67k/3.67k [00:00<00:00, 11.9MB/s]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Downloading and preparing dataset housing_qa/questions (download: 963.72 KiB, generated: 18.27 MiB, post-processed: Unknown size, total: 19.21 MiB) to /Users/neelguha/.cache/huggingface/datasets/reglab___housing_qa/questions/1.0.0/72d4d5c21c6043dceebcc4cb378b5258ba6b3c0db013d32c0627b85a4c6f50bc...\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Downloading data: 100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 987k/987k [00:00<00:00, 7.34MB/s]\n",
" \r"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Dataset housing_qa downloaded and prepared to /Users/neelguha/.cache/huggingface/datasets/reglab___housing_qa/questions/1.0.0/72d4d5c21c6043dceebcc4cb378b5258ba6b3c0db013d32c0627b85a4c6f50bc. Subsequent calls will reuse this data.\n"
]
},
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>idx</th>\n",
" <th>state</th>\n",
" <th>question</th>\n",
" <th>answer</th>\n",
" <th>question_group</th>\n",
" <th>statutes</th>\n",
" <th>original_question</th>\n",
" <th>caveats</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>0</td>\n",
" <td>Alabama</td>\n",
" <td>Is there a state/territory law regulating resi...</td>\n",
" <td>Yes</td>\n",
" <td>69</td>\n",
" <td>{'statute_idx': [431263], 'citation': ['ALA. C...</td>\n",
" <td>Is there a state/territory law regulating resi...</td>\n",
" <td>[]</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>163</td>\n",
" <td>Alabama</td>\n",
" <td>Does the law specify a minimum number of days ...</td>\n",
" <td>Yes</td>\n",
" <td>23</td>\n",
" <td>{'statute_idx': [431277], 'citation': ['ALA. C...</td>\n",
" <td>Does the law specify a minimum number of days ...</td>\n",
" <td>[]</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>237</td>\n",
" <td>Alabama</td>\n",
" <td>Does the law specify rebuttals available to te...</td>\n",
" <td>Yes</td>\n",
" <td>116</td>\n",
" <td>{'statute_idx': [417060, 431274, 431280, 43127...</td>\n",
" <td>Does the law specify rebuttals available to a ...</td>\n",
" <td>[]</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>286</td>\n",
" <td>Alabama</td>\n",
" <td>In eviction proceedings, does the filing of an...</td>\n",
" <td>Yes</td>\n",
" <td>4</td>\n",
" <td>{'statute_idx': [431286], 'citation': ['ALA. C...</td>\n",
" <td>Does the filing of an appeal stay the executio...</td>\n",
" <td>[]</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>353</td>\n",
" <td>Alabama</td>\n",
" <td>Is it specified whether a landlord waives thei...</td>\n",
" <td>Yes</td>\n",
" <td>201</td>\n",
" <td>{'statute_idx': [431280], 'citation': ['ALA. C...</td>\n",
" <td>Does a landlord waive their right to evict for...</td>\n",
" <td>[A landlord waives their right to evict by acc...</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" idx state question answer \\\n",
"0 0 Alabama Is there a state/territory law regulating resi... Yes \n",
"1 163 Alabama Does the law specify a minimum number of days ... Yes \n",
"2 237 Alabama Does the law specify rebuttals available to te... Yes \n",
"3 286 Alabama In eviction proceedings, does the filing of an... Yes \n",
"4 353 Alabama Is it specified whether a landlord waives thei... Yes \n",
"\n",
" question_group statutes \\\n",
"0 69 {'statute_idx': [431263], 'citation': ['ALA. C... \n",
"1 23 {'statute_idx': [431277], 'citation': ['ALA. C... \n",
"2 116 {'statute_idx': [417060, 431274, 431280, 43127... \n",
"3 4 {'statute_idx': [431286], 'citation': ['ALA. C... \n",
"4 201 {'statute_idx': [431280], 'citation': ['ALA. C... \n",
"\n",
" original_question \\\n",
"0 Is there a state/territory law regulating resi... \n",
"1 Does the law specify a minimum number of days ... \n",
"2 Does the law specify rebuttals available to a ... \n",
"3 Does the filing of an appeal stay the executio... \n",
"4 Does a landlord waive their right to evict for... \n",
"\n",
" caveats \n",
"0 [] \n",
"1 [] \n",
"2 [] \n",
"3 [] \n",
"4 [A landlord waives their right to evict by acc... "
]
},
"execution_count": 28,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"questions = load_dataset(\"reglab/housing_qa\", \"questions\", split=\"test\", download_mode=\"force_redownload\")\n",
"questions.to_pandas().head(5)"
]
},
{
"cell_type": "code",
"execution_count": 30,
"id": "3931e731-006f-4731-8350-a7f83ea3f298",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'idx': 237,\n",
" 'state': 'Alabama',\n",
" 'question': 'Does the law specify rebuttals available to tenants subject to eviction proceedings?',\n",
" 'answer': 'Yes',\n",
" 'question_group': 116,\n",
" 'statutes': {'statute_idx': [417060, 431274, 431280, 431273, 431271],\n",
" 'citation': ['ALA. CODE Β§ 35-9A-501(B)',\n",
" 'ALA. CODE Β§ 35-9A-405(A)',\n",
" 'ALA. CODE Β§ 35-9A-424',\n",
" 'ALA. CODE Β§ 35-9A-404(B)',\n",
" 'ALA. CODE Β§ 35-9A-401(A)'],\n",
" 'excerpt': ['(b) If a landlord acts in violation of subsection (a), the tenant is entitled to the remedies provided in Section 35-9A-407 and has a defense in any retaliatory action against the tenant for possession.',\n",
" \"(a) In an action for possession or in an action for rent when the tenant is in possession, the tenant may counterclaim for any amount the tenant may recover under the rental agreement or this chapter. It is in the court's discretion whether the tenant is to remain in possession. The tenant shall pay into court rent accrued and thereafter accruing as it comes due. The court shall determine the amount due to each party. The party to whom a net amount is owed shall be paid first from the money paid into court, and the balance by the other party. If no rent remains due after application of this section, judgment shall be entered for the tenant in the action for possession. If the defense or counterclaim by the tenant is without merit and is not raised in good faith, the landlord may recover reasonable attorney's fees.\",\n",
" \"Acceptance of rent with knowledge of a default by the tenant or acceptance of performance by the tenant that varies from the terms of the rental agreement constitutes a waiver of the landlord's right to terminate the rental agreement for that breach, unless otherwise agreed after the breach has occurred.\",\n",
" '(b) If contrary to the rental agreement or Section 35-9A-204, after receiving notice of the breach from the tenant, the landlord willfully or negligently fails to promptly make available heat, running water, hot water, electric, gas, or other essential service, the tenant may:(1) send a written notice specifying the date of termination not less than 14 days after receipt of notice and upon vacation of the premises, the rental agreement shall be rightfully terminated without further obligation or penalty. If the rental agreement is terminated pursuant to this section, the landlord shall return all security recoverable by the tenant under Section 35-9A-201 and all unearned prepaid rent; or(2) recover damages based upon the diminution in the fair rental value of the dwelling unit.',\n",
" '(a) Except as provided in this chapter, if there is a material noncompliance by the landlord with the rental agreement or a noncompliance with Section 35-9A-204 materially affecting health and safety, the tenant may deliver a written notice to the landlord specifying the acts and omissions constituting the breach and that the rental agreement will terminate upon a date not less than 14 days after receipt of the notice if the breach is not remedied within that period, and the rental agreement shall terminate as provided in the notice subject to the following:']},\n",
" 'original_question': 'Does the law specify rebuttals available to a tenant?',\n",
" 'caveats': ['']}"
]
},
"execution_count": 30,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"for q in questions:\n",
" if len(q[\"statutes\"][\"citation\"]) > 1:\n",
" break \n",
"q"
]
},
{
"cell_type": "markdown",
"id": "c30a72f9-0ebe-4d33-abbd-e53883d04be5",
"metadata": {},
"source": [
"# RC Questions"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "92c9606a-09a5-44c6-94f2-4c9773c1a754",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Downloading data: 100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββ| 987k/987k [00:00<00:00, 10.7MB/s]\n",
"Generating test split: 6853 examples [00:00, 25871.49 examples/s]\n"
]
},
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>idx</th>\n",
" <th>state</th>\n",
" <th>question</th>\n",
" <th>answer</th>\n",
" <th>question_group</th>\n",
" <th>statutes</th>\n",
" <th>original_question</th>\n",
" <th>caveats</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>0</td>\n",
" <td>Alabama</td>\n",
" <td>Is there a state/territory law regulating resi...</td>\n",
" <td>Yes</td>\n",
" <td>69</td>\n",
" <td>{'statute_idx': [431263], 'citation': ['ALA. C...</td>\n",
" <td>Is there a state/territory law regulating resi...</td>\n",
" <td>[[]]</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>163</td>\n",
" <td>Alabama</td>\n",
" <td>Does the law specify a minimum number of days ...</td>\n",
" <td>Yes</td>\n",
" <td>23</td>\n",
" <td>{'statute_idx': [431277], 'citation': ['ALA. C...</td>\n",
" <td>Does the law specify a minimum number of days ...</td>\n",
" <td>[[]]</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>237</td>\n",
" <td>Alabama</td>\n",
" <td>Does the law specify rebuttals available to te...</td>\n",
" <td>Yes</td>\n",
" <td>116</td>\n",
" <td>{'statute_idx': [417060, 431274, 431280, 43127...</td>\n",
" <td>Does the law specify rebuttals available to a ...</td>\n",
" <td>[[]]</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>286</td>\n",
" <td>Alabama</td>\n",
" <td>In eviction proceedings, does the filing of an...</td>\n",
" <td>Yes</td>\n",
" <td>4</td>\n",
" <td>{'statute_idx': [431286], 'citation': ['ALA. C...</td>\n",
" <td>Does the filing of an appeal stay the executio...</td>\n",
" <td>[[]]</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>353</td>\n",
" <td>Alabama</td>\n",
" <td>Is it specified whether a landlord waives thei...</td>\n",
" <td>Yes</td>\n",
" <td>201</td>\n",
" <td>{'statute_idx': [431280], 'citation': ['ALA. C...</td>\n",
" <td>Does a landlord waive their right to evict for...</td>\n",
" <td>[[A, , l, a, n, d, l, o, r, d, , w, a, i, v,...</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" idx state question answer \\\n",
"0 0 Alabama Is there a state/territory law regulating resi... Yes \n",
"1 163 Alabama Does the law specify a minimum number of days ... Yes \n",
"2 237 Alabama Does the law specify rebuttals available to te... Yes \n",
"3 286 Alabama In eviction proceedings, does the filing of an... Yes \n",
"4 353 Alabama Is it specified whether a landlord waives thei... Yes \n",
"\n",
" question_group statutes \\\n",
"0 69 {'statute_idx': [431263], 'citation': ['ALA. C... \n",
"1 23 {'statute_idx': [431277], 'citation': ['ALA. C... \n",
"2 116 {'statute_idx': [417060, 431274, 431280, 43127... \n",
"3 4 {'statute_idx': [431286], 'citation': ['ALA. C... \n",
"4 201 {'statute_idx': [431280], 'citation': ['ALA. C... \n",
"\n",
" original_question \\\n",
"0 Is there a state/territory law regulating resi... \n",
"1 Does the law specify a minimum number of days ... \n",
"2 Does the law specify rebuttals available to a ... \n",
"3 Does the filing of an appeal stay the executio... \n",
"4 Does a landlord waive their right to evict for... \n",
"\n",
" caveats \n",
"0 [[]] \n",
"1 [[]] \n",
"2 [[]] \n",
"3 [[]] \n",
"4 [[A, , l, a, n, d, l, o, r, d, , w, a, i, v,... "
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"questions = load_dataset(\"reglab/housing_qa\", \"rc_questions\")\n",
"questions[\"test\"].to_pandas().head(5)"
]
},
{
"cell_type": "markdown",
"id": "692490c0-eaa3-4f88-9b25-630f6ce736a3",
"metadata": {},
"source": [
"# Statutes"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "b4ce7ae9-618f-4594-be69-b53a58e580e4",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>citation</th>\n",
" <th>path</th>\n",
" <th>state</th>\n",
" <th>text</th>\n",
" <th>idx</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>MO Rev Stat Β§ 1.010 (2021)</td>\n",
" <td>2021 Missouri Revised Statutes|Title I - Laws ...</td>\n",
" <td>missouri</td>\n",
" <td>Effective - 28 Aug 2015 1.010. Common law in...</td>\n",
" <td>0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>MO Rev Stat Β§ 1.020 (2021)</td>\n",
" <td>2021 Missouri Revised Statutes|Title I - Laws ...</td>\n",
" <td>missouri</td>\n",
" <td>Effective - 28 Aug 2009 1.020. Definitions. ...</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>MO Rev Stat Β§ 1.025 (2021)</td>\n",
" <td>2021 Missouri Revised Statutes|Title I - Laws ...</td>\n",
" <td>missouri</td>\n",
" <td>Effective - 28 Aug 1958 1.025. Registered ma...</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>MO Rev Stat Β§ 1.028 (2021)</td>\n",
" <td>2021 Missouri Revised Statutes|Title I - Laws ...</td>\n",
" <td>missouri</td>\n",
" <td>Effective - 28 Aug 1999 1.028. English is th...</td>\n",
" <td>3</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>MO Rev Stat Β§ 1.030 (2021)</td>\n",
" <td>2021 Missouri Revised Statutes|Title I - Laws ...</td>\n",
" <td>missouri</td>\n",
" <td>Effective - 28 Aug 1957 1.030. Plural includ...</td>\n",
" <td>4</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" citation \\\n",
"0 MO Rev Stat Β§ 1.010 (2021) \n",
"1 MO Rev Stat Β§ 1.020 (2021) \n",
"2 MO Rev Stat Β§ 1.025 (2021) \n",
"3 MO Rev Stat Β§ 1.028 (2021) \n",
"4 MO Rev Stat Β§ 1.030 (2021) \n",
"\n",
" path state \\\n",
"0 2021 Missouri Revised Statutes|Title I - Laws ... missouri \n",
"1 2021 Missouri Revised Statutes|Title I - Laws ... missouri \n",
"2 2021 Missouri Revised Statutes|Title I - Laws ... missouri \n",
"3 2021 Missouri Revised Statutes|Title I - Laws ... missouri \n",
"4 2021 Missouri Revised Statutes|Title I - Laws ... missouri \n",
"\n",
" text idx \n",
"0 Effective - 28 Aug 2015 1.010. Common law in... 0 \n",
"1 Effective - 28 Aug 2009 1.020. Definitions. ... 1 \n",
"2 Effective - 28 Aug 1958 1.025. Registered ma... 2 \n",
"3 Effective - 28 Aug 1999 1.028. English is th... 3 \n",
"4 Effective - 28 Aug 1957 1.030. Plural includ... 4 "
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"statutes = load_dataset(\"reglab/housing_qa\", \"statutes\")\n",
"statutes[\"corpus\"].to_pandas().head(5)"
]
}
],
"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.8.18"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
|