Datasets:

File size: 4,021 Bytes
9ab2868
 
 
 
192f2c0
9ab2868
 
 
 
 
 
 
 
 
 
192f2c0
9ab2868
 
 
 
 
 
 
192f2c0
9ab2868
 
 
 
 
 
 
 
 
 
 
 
 
 
192f2c0
9ab2868
 
192f2c0
9ab2868
 
 
 
 
192f2c0
9ab2868
 
 
 
 
192f2c0
9ab2868
 
 
 
 
 
 
 
 
 
 
 
192f2c0
9ab2868
 
 
 
 
 
 
 
 
 
 
 
 
 
 
192f2c0
9ab2868
 
192f2c0
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
119
120
121
122
123
124
125
126
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "fce498ac-4ea7-4e10-a15a-60ac41e3adce",
   "metadata": {},
   "outputs": [],
   "source": [
    "from datasets import load_dataset\n",
    "from collections import Counter"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "73aaafd1-3ebb-42f7-b162-2e6bc630d195",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Found cached dataset housing_qa (/Users/neelguha/.cache/huggingface/datasets/reglab___housing_qa/questions/1.0.0/c3f397c8b54111729d49ff66d6145d407a535b137643491f86e3dc7b858cf34a)\n"
     ]
    },
    {
     "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": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "questions = load_dataset(\"reglab/housing_qa\", \"questions\", split=\"test\")\n",
    "questions[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "c28a88fe-933f-424c-9b81-fc43eea34dee",
   "metadata": {},
   "outputs": [],
   "source": [
    "counts = []\n",
    "for sample in questions: \n",
    "    if len(sample[\"caveats\"][0]) > 0:\n",
    "        break "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "2c24819e-0019-4c60-9284-77bfa565ecc5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'idx': 353,\n",
       " 'state': 'Alabama',\n",
       " 'question': 'Is it specified whether a landlord waives their right to evict for nonpayment of rent by accepting partial payment of rent?',\n",
       " 'answer': 'Yes',\n",
       " 'question_group': 201,\n",
       " 'statutes': {'statute_idx': [431280],\n",
       "  'citation': ['ALA. CODE § 35-9A-424'],\n",
       "  'excerpt': [\"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",
       " 'original_question': 'Does a landlord waive their right to evict for nonpayment of rent by accepting partial payment of rent?',\n",
       " 'caveats': ['A landlord waives their right to evict by accepting payment of rent, Ala. Code § 35-9A-424, but the law does not specify whether acceptance of full or partial payment is required for the waiver.']}"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sample"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "893dbd5a-e351-43a9-b939-ed022a78b78a",
   "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
}