{
"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": 17,
"id": "2cb75e7c-b7eb-4601-85f3-cc27c1f5ff94",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Downloading builder script: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3.64k/3.64k [00:00<00:00, 13.8MB/s]\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Downloading and preparing dataset housing_qa/questions to /Users/neelguha/.cache/huggingface/datasets/reglab___housing_qa/questions/1.0.0/8bf686206d753eb1bc023c1aa0b7841398d312cdf6a0e537f27fb74f6eab4eef...\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"Downloading data: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 987k/987k [00:00<00:00, 6.72MB/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/8bf686206d753eb1bc023c1aa0b7841398d312cdf6a0e537f27fb74f6eab4eef. Subsequent calls will reuse this data.\n"
]
},
{
"data": {
"text/html": [
"
\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" idx | \n",
" state | \n",
" question | \n",
" answer | \n",
" question_group | \n",
" statutes | \n",
" original_question | \n",
" caveats | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" 0 | \n",
" Alabama | \n",
" Is there a state/territory law regulating resi... | \n",
" Yes | \n",
" 69 | \n",
" {'statute_idx': [431263], 'citation': ['ALA. C... | \n",
" Is there a state/territory law regulating resi... | \n",
" [] | \n",
"
\n",
" \n",
" 1 | \n",
" 163 | \n",
" Alabama | \n",
" Does the law specify a minimum number of days ... | \n",
" Yes | \n",
" 23 | \n",
" {'statute_idx': [431277], 'citation': ['ALA. C... | \n",
" Does the law specify a minimum number of days ... | \n",
" [] | \n",
"
\n",
" \n",
" 2 | \n",
" 237 | \n",
" Alabama | \n",
" Does the law specify rebuttals available to te... | \n",
" Yes | \n",
" 116 | \n",
" {'statute_idx': [417060, 431274, 431280, 43127... | \n",
" Does the law specify rebuttals available to a ... | \n",
" [] | \n",
"
\n",
" \n",
" 3 | \n",
" 286 | \n",
" Alabama | \n",
" In eviction proceedings, does the filing of an... | \n",
" Yes | \n",
" 4 | \n",
" {'statute_idx': [431286], 'citation': ['ALA. C... | \n",
" Does the filing of an appeal stay the executio... | \n",
" [] | \n",
"
\n",
" \n",
" 4 | \n",
" 353 | \n",
" Alabama | \n",
" Is it specified whether a landlord waives thei... | \n",
" Yes | \n",
" 201 | \n",
" {'statute_idx': [431280], 'citation': ['ALA. C... | \n",
" Does a landlord waive their right to evict for... | \n",
" [A landlord waives their right to evict by acc... | \n",
"
\n",
" \n",
"
\n",
"
"
],
"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": 17,
"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": 18,
"id": "3931e731-006f-4731-8350-a7f83ea3f298",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'idx': 0,\n",
" 'state': 'Alabama',\n",
" 'question': 'Is there a state/territory law regulating residential evictions?',\n",
" 'answer': 'Yes',\n",
" 'question_group': 69,\n",
" 'statutes': {'statute_idx': [431263],\n",
" 'citation': ['ALA. CODE § 35-9A-141(11)'],\n",
" 'excerpt': ['(11) “premises” means a dwelling unit and the structure of which it is a part and facilities and appurtenances therein and grounds, areas, and facilities held out for the use of tenants generally or whose use is promised by the rental agreement to the tenant;']},\n",
" 'original_question': 'Is there a state/territory law regulating residential evictions?',\n",
" 'caveats': ['']}"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"questions[0]"
]
},
{
"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": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" idx | \n",
" state | \n",
" question | \n",
" answer | \n",
" question_group | \n",
" statutes | \n",
" original_question | \n",
" caveats | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" 0 | \n",
" Alabama | \n",
" Is there a state/territory law regulating resi... | \n",
" Yes | \n",
" 69 | \n",
" {'statute_idx': [431263], 'citation': ['ALA. C... | \n",
" Is there a state/territory law regulating resi... | \n",
" [[]] | \n",
"
\n",
" \n",
" 1 | \n",
" 163 | \n",
" Alabama | \n",
" Does the law specify a minimum number of days ... | \n",
" Yes | \n",
" 23 | \n",
" {'statute_idx': [431277], 'citation': ['ALA. C... | \n",
" Does the law specify a minimum number of days ... | \n",
" [[]] | \n",
"
\n",
" \n",
" 2 | \n",
" 237 | \n",
" Alabama | \n",
" Does the law specify rebuttals available to te... | \n",
" Yes | \n",
" 116 | \n",
" {'statute_idx': [417060, 431274, 431280, 43127... | \n",
" Does the law specify rebuttals available to a ... | \n",
" [[]] | \n",
"
\n",
" \n",
" 3 | \n",
" 286 | \n",
" Alabama | \n",
" In eviction proceedings, does the filing of an... | \n",
" Yes | \n",
" 4 | \n",
" {'statute_idx': [431286], 'citation': ['ALA. C... | \n",
" Does the filing of an appeal stay the executio... | \n",
" [[]] | \n",
"
\n",
" \n",
" 4 | \n",
" 353 | \n",
" Alabama | \n",
" Is it specified whether a landlord waives thei... | \n",
" Yes | \n",
" 201 | \n",
" {'statute_idx': [431280], 'citation': ['ALA. C... | \n",
" Does a landlord waive their right to evict for... | \n",
" [[A, , l, a, n, d, l, o, r, d, , w, a, i, v,... | \n",
"
\n",
" \n",
"
\n",
"
"
],
"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": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" citation | \n",
" path | \n",
" state | \n",
" text | \n",
" idx | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" MO Rev Stat § 1.010 (2021) | \n",
" 2021 Missouri Revised Statutes|Title I - Laws ... | \n",
" missouri | \n",
" Effective - 28 Aug 2015 1.010. Common law in... | \n",
" 0 | \n",
"
\n",
" \n",
" 1 | \n",
" MO Rev Stat § 1.020 (2021) | \n",
" 2021 Missouri Revised Statutes|Title I - Laws ... | \n",
" missouri | \n",
" Effective - 28 Aug 2009 1.020. Definitions. ... | \n",
" 1 | \n",
"
\n",
" \n",
" 2 | \n",
" MO Rev Stat § 1.025 (2021) | \n",
" 2021 Missouri Revised Statutes|Title I - Laws ... | \n",
" missouri | \n",
" Effective - 28 Aug 1958 1.025. Registered ma... | \n",
" 2 | \n",
"
\n",
" \n",
" 3 | \n",
" MO Rev Stat § 1.028 (2021) | \n",
" 2021 Missouri Revised Statutes|Title I - Laws ... | \n",
" missouri | \n",
" Effective - 28 Aug 1999 1.028. English is th... | \n",
" 3 | \n",
"
\n",
" \n",
" 4 | \n",
" MO Rev Stat § 1.030 (2021) | \n",
" 2021 Missouri Revised Statutes|Title I - Laws ... | \n",
" missouri | \n",
" Effective - 28 Aug 1957 1.030. Plural includ... | \n",
" 4 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"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
}