Datasets:

File size: 4,241 Bytes
9ab2868
 
 
 
d2d505b
 
9ab2868
 
 
d2d505b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9ab2868
 
 
 
d2d505b
 
9ab2868
 
 
192f2c0
 
 
 
 
 
 
d2d505b
 
 
192f2c0
 
 
 
d2d505b
9ab2868
 
 
 
 
d2d505b
9ab2868
 
 
 
 
d2d505b
9ab2868
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "2c24819e-0019-4c60-9284-77bfa565ecc5",
   "metadata": {},
   "outputs": [],
   "source": [
    "from datasets import Dataset, DatasetInfo, Features, ClassLabel, Value, Sequence, DatasetDict\n",
    "\n",
    "# Define the dataset's schema\n",
    "features = Features({\n",
    "    'idx': Value('int32'),\n",
    "    'state': Value('string'),\n",
    "    'question': Value('string'),\n",
    "    'answer': Value('string'),\n",
    "    'question_group': Value('int32'),\n",
    "    'statutes': Sequence({\n",
    "        'statute_idx': Value('int32'),\n",
    "        'citation': Value('string'),\n",
    "        'excerpt': Value('string'),\n",
    "    }),\n",
    "    'original_question': Value('string'),\n",
    "    'caveats': Sequence(Value('string')),\n",
    "})\n",
    "\n",
    "# Create a DatasetInfo object for additional metadata\n",
    "dataset_info = DatasetInfo(\n",
    "    description=\"A dataset containing information on state/territory laws regulating residential evictions, including relevant legal statutes.\",\n",
    "    features=features,\n",
    "    supervised_keys=None,  # No supervised keys as this dataset doesn't include labels for training models\n",
    "    homepage=\"http://example.com\",  # Add a real homepage if applicable\n",
    "    citation=\"Citation information for the dataset\",\n",
    ")\n",
    "\n",
    "# Load dataset from your data source\n",
    "# Assuming your data is in JSON or other format, use appropriate loading function\n",
    "dataset = DatasetDict({\n",
    "    'train': Dataset.from_dict({\n",
    "        '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': [[{\n",
    "            'statute_idx': 431263,\n",
    "            'citation': 'ALA. CODE \\u00a7 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",
    "        }]],\n",
    "        'original_question': ['Is there a state/territory law regulating residential evictions?'],\n",
    "        'caveats': [['']],\n",
    "    })\n",
    "})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "893dbd5a-e351-43a9-b939-ed022a78b78a",
   "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': [{'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",
       "   'statute_idx': 431263}],\n",
       " 'original_question': 'Is there a state/territory law regulating residential evictions?',\n",
       " 'caveats': ['']}"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dataset[\"train\"][0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "98fc7ef8-24e8-4e02-ba9f-215330fca3c6",
   "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.8.18"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}