{ "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 }