pasinit commited on
Commit
bec1275
1 Parent(s): 1bdeffb
Files changed (1) hide show
  1. scotus.py +421 -0
scotus.py ADDED
@@ -0,0 +1,421 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from dataclasses import dataclass
2
+ import datasets
3
+ from datasets.info import DatasetInfo
4
+ from datasets.load import load_dataset
5
+ from datasets.utils.download_manager import DownloadManager
6
+ import os
7
+ import jsonlines
8
+ import json
9
+
10
+ _DESCRIPTION = """Dataset extracted from case laws of Supreme Court of United States."""
11
+
12
+ _VERSION = "0.4.0"
13
+ _DOWNLOAD_URL='https://sid.erda.dk/share_redirect/ceCWid0G3T'
14
+ ISSUE_AREAS = "Criminal Procedure,Civil Rights,First Amendment,Due Process,Privacy,Attorneys,Unions,Economic Activity,Judicial Power,Federalism,Federal Taxation".split(
15
+ ","
16
+ )
17
+
18
+ PERSON = "person"
19
+ PUBLIC_ENTITY = "public_entity"
20
+ ORGANIZATION = "organization"
21
+ OTHER = "other"
22
+ FACILITY = "facility"
23
+
24
+ RESPONDENT_MAPPING = {
25
+ "attorney general of the United States, or his office": PERSON,
26
+ "specified state board or department of education": PUBLIC_ENTITY,
27
+ "city, town, township, village, or borough government or governmental unit": PUBLIC_ENTITY,
28
+ "state commission, board, committee, or authority": PUBLIC_ENTITY,
29
+ "county government or county governmental unit, except school district": PUBLIC_ENTITY,
30
+ "court or judicial district": PUBLIC_ENTITY,
31
+ "state department or agency": PUBLIC_ENTITY,
32
+ "governmental employee or job applicant": PERSON,
33
+ "female governmental employee or job applicant": PERSON,
34
+ "minority governmental employee or job applicant": PERSON,
35
+ "minority female governmental employee or job applicant": PERSON,
36
+ "not listed among agencies in the first Administrative Action variable": OTHER,
37
+ "retired or former governmental employee": PERSON,
38
+ "U.S. House of Representatives": PUBLIC_ENTITY,
39
+ "interstate compact": PUBLIC_ENTITY,
40
+ "judge": PERSON,
41
+ "state legislature, house, or committee": PUBLIC_ENTITY,
42
+ "local governmental unit other than a county, city, town, township, village, or borough": PUBLIC_ENTITY,
43
+ "governmental official, or an official of an agency established under an interstate compact": PUBLIC_ENTITY,
44
+ "state or U.S. supreme court": PUBLIC_ENTITY,
45
+ "local school district or board of education": PUBLIC_ENTITY,
46
+ "U.S. Senate": PUBLIC_ENTITY,
47
+ "U.S. senator": PERSON,
48
+ "foreign nation or instrumentality": PUBLIC_ENTITY,
49
+ "state or local governmental taxpayer, or executor of the estate of": PUBLIC_ENTITY,
50
+ "state college or university": PUBLIC_ENTITY,
51
+ "United States": PUBLIC_ENTITY,
52
+ "State": PUBLIC_ENTITY,
53
+ "person accused, indicted, or suspected of crime": PERSON,
54
+ "advertising business or agency": ORGANIZATION,
55
+ "agent, fiduciary, trustee, or executor": ORGANIZATION,
56
+ "airplane manufacturer, or manufacturer of parts of airplanes": ORGANIZATION,
57
+ "airline": ORGANIZATION,
58
+ "distributor, importer, or exporter of alcoholic beverages": ORGANIZATION,
59
+ "alien, person subject to a denaturalization proceeding, or one whose citizenship is revoked": PERSON,
60
+ "American Medical Association": PERSON,
61
+ "National Railroad Passenger Corp.": ORGANIZATION,
62
+ "amusement establishment, or recreational facility": FACILITY,
63
+ "arrested person, or pretrial detainee": PERSON,
64
+ "attorney, or person acting as such;includes bar applicant or law student, or law firm or bar association": PERSON,
65
+ "author, copyright holder": OTHER,
66
+ "bank, savings and loan, credit union, investment company": ORGANIZATION,
67
+ "bankrupt person or business, or business in reorganization": OTHER,
68
+ "establishment serving liquor by the glass, or package liquor store": ORGANIZATION,
69
+ "water transportation, stevedore": OTHER,
70
+ "bookstore, newsstand, printer, bindery, purveyor or distributor of books or magazines": ORGANIZATION,
71
+ "brewery, distillery": ORGANIZATION,
72
+ "broker, stock exchange, investment or securities firm": ORGANIZATION,
73
+ "construction industry": ORGANIZATION,
74
+ "bus or motorized passenger transportation vehicle": OTHER,
75
+ "business, corporation": ORGANIZATION,
76
+ "buyer, purchaser": OTHER,
77
+ "cable TV": OTHER,
78
+ "car dealer": PERSON,
79
+ "person convicted of crime": PERSON,
80
+ "tangible property, other than real estate, including contraband": OTHER,
81
+ "chemical company": ORGANIZATION,
82
+ "child, children, including adopted or illegitimate": PERSON,
83
+ "religious organization, institution, or person": OTHER,
84
+ "private club or facility": FACILITY,
85
+ "coal company or coal mine operator": OTHER,
86
+ "computer business or manufacturer, hardware or software": ORGANIZATION,
87
+ "consumer, consumer organization": OTHER,
88
+ "creditor, including institution appearing as such; e.g., a finance company": OTHER,
89
+ "person allegedly criminally insane or mentally incompetent to stand trial": PERSON,
90
+ "defendant": OTHER,
91
+ "debtor": OTHER,
92
+ "real estate developer": PERSON,
93
+ "disabled person or disability benefit claimant": PERSON,
94
+ "distributor": OTHER,
95
+ "person subject to selective service, including conscientious objector": PERSON,
96
+ "drug manufacturer": ORGANIZATION,
97
+ "druggist, pharmacist, pharmacy": OTHER,
98
+ "employee, or job applicant, including beneficiaries of": PERSON,
99
+ "employer-employee trust agreement, employee health and welfare fund, or multi-employer pension plan": OTHER,
100
+ "electric equipment manufacturer": ORGANIZATION,
101
+ "electric or hydroelectric power utility, power cooperative, or gas and electric company": ORGANIZATION,
102
+ "eleemosynary institution or person": OTHER,
103
+ "environmental organization": ORGANIZATION,
104
+ "employer. If employer's relations with employees are governed by the nature of the employer's business (e.g., railroad, boat), rather than labor law generally, the more specific designation is used in place of Employer.":PERSON,
105
+ "farmer, farm worker, or farm organization": PERSON,
106
+ "father": PERSON,
107
+ "female employee or job applicant": PERSON,
108
+ "female": PERSON,
109
+ "movie, play, pictorial representation, theatrical production, actor, or exhibitor or distributor of": OTHER,
110
+ "fisherman or fishing company": OTHER,
111
+ "food, meat packing, or processing company, stockyard": OTHER,
112
+ "foreign (non-American) nongovernmental entity": OTHER,
113
+ "franchiser": PERSON,
114
+ "franchisee": ORGANIZATION,
115
+ "lesbian, gay, bisexual, transexual person or organization": OTHER,
116
+ "person who guarantees another's obligations": PERSON,
117
+ "handicapped individual, or organization of devoted to": OTHER,
118
+ "health organization or person, nursing home, medical clinic or laboratory, chiropractor": OTHER,
119
+ "heir, or beneficiary, or person so claiming to be": OTHER,
120
+ "hospital, medical center": OTHER,
121
+ "husband, or ex-husband": PERSON,
122
+ "involuntarily committed mental patient": PERSON,
123
+ "Indian, including Indian tribe or nation": OTHER,
124
+ "insurance company, or surety": ORGANIZATION,
125
+ "inventor, patent assigner, trademark owner or holder": OTHER,
126
+ "investor": PERSON,
127
+ "injured person or legal entity, nonphysically and non-employment related": OTHER,
128
+ "juvenile": OTHER,
129
+ "government contractor": OTHER,
130
+ "holder of a license or permit, or applicant therefor": OTHER,
131
+ "magazine": ORGANIZATION,
132
+ "male": PERSON,
133
+ "medical or Medicaid claimant": PERSON,
134
+ "medical supply or manufacturing co.": OTHER,
135
+ "racial or ethnic minority employee or job applicant": PERSON,
136
+ "minority female employee or job applicant": PERSON,
137
+ "manufacturer": ORGANIZATION,
138
+ "management, executive officer, or director, of business entity": PERSON,
139
+ "military personnel, or dependent of, including reservist": PERSON,
140
+ "mining company or miner, excluding coal, oil, or pipeline company": ORGANIZATION,
141
+ "mother": PERSON,
142
+ "auto manufacturer": ORGANIZATION,
143
+ "newspaper, newsletter, journal of opinion, news service": ORGANIZATION,
144
+ "radio and television network, except cable tv": ORGANIZATION,
145
+ "nonprofit organization or business": ORGANIZATION,
146
+ "nonresident": PERSON,
147
+ "nuclear power plant or facility": FACILITY,
148
+ "owner, landlord, or claimant to ownership, fee interest, or possession of land as well as chattels": OTHER,
149
+ "shareholders to whom a tender offer is made": OTHER,
150
+ "tender offer": OTHER,
151
+ "oil company, or natural gas producer": ORGANIZATION,
152
+ "elderly person, or organization dedicated to the elderly": OTHER,
153
+ "out of state noncriminal defendant": PERSON,
154
+ "political action committee": ORGANIZATION,
155
+ "parent or parents": PERSON,
156
+ "parking lot or service": OTHER,
157
+ "patient of a health professional": PERSON,
158
+ "telephone, telecommunications, or telegraph company": ORGANIZATION,
159
+ "physician, MD or DO, dentist, or medical society": OTHER,
160
+ "public interest organization": ORGANIZATION,
161
+ "physically injured person, including wrongful death, who is not an employee": PERSON,
162
+ "pipe line company": ORGANIZATION,
163
+ "package, luggage, container": OTHER,
164
+ "political candidate, activist, committee, party, party member, organization, or elected official": OTHER,
165
+ "indigent, needy, welfare recipient": PERSON,
166
+ "indigent defendant": PERSON,
167
+ "private person": PERSON,
168
+ "prisoner, inmate of penal institution": PERSON,
169
+ "professional organization, business, or person": OTHER,
170
+ "probationer, or parolee": OTHER,
171
+ "protester, demonstrator, picketer or pamphleteer (non-employment related), or non-indigent loiterer": PERSON,
172
+ "public utility": OTHER,
173
+ "publisher, publishing company": ORGANIZATION,
174
+ "radio station": ORGANIZATION,
175
+ "racial or ethnic minority": PERSON,
176
+ "person or organization protesting racial or ethnic segregation or discrimination": OTHER,
177
+ "racial or ethnic minority student or applicant for admission to an educational institution": PERSON,
178
+ "realtor": PERSON,
179
+ "journalist, columnist, member of the news media": PERSON,
180
+ "resident": PERSON,
181
+ "restaurant, food vendor": ORGANIZATION,
182
+ "retarded person, or mental incompetent": PERSON,
183
+ "retired or former employee": PERSON,
184
+ "railroad": FACILITY,
185
+ "private school, college, or university": ORGANIZATION,
186
+ "seller or vendor": PERSON,
187
+ "shipper, including importer and exporter": OTHER,
188
+ "shopping center, mall": FACILITY,
189
+ "spouse, or former spouse": PERSON,
190
+ "stockholder, shareholder, or bondholder": OTHER,
191
+ "retail business or outlet": ORGANIZATION,
192
+ "student, or applicant for admission to an educational institution": PERSON,
193
+ "taxpayer or executor of taxpayer's estate, federal only": PERSON,
194
+ "tenant or lessee": OTHER,
195
+ "theater, studio": FACILITY,
196
+ "forest products, lumber, or logging company": ORGANIZATION,
197
+ "person traveling or wishing to travel abroad, or overseas travel agent": PERSON,
198
+ "trucking company, or motor carrier": ORGANIZATION,
199
+ "television station": ORGANIZATION,
200
+ "union member": OTHER,
201
+ "unemployed person or unemployment compensation applicant or claimant": PERSON,
202
+ "union, labor organization, or official of": ORGANIZATION,
203
+ "veteran": PERSON,
204
+ "voter, prospective voter, elector, or a nonelective official seeking reapportionment or redistricting of legislative districts (POL)": PERSON,
205
+ "wholesale trade": OTHER,
206
+ "wife, or ex-wife": PERSON,
207
+ "witness, or person under subpoena": PERSON,
208
+ "network": OTHER,
209
+ "slave": PERSON,
210
+ "slave-owner": PERSON,
211
+ "bank of the united states": ORGANIZATION,
212
+ "timber company": ORGANIZATION,
213
+ "u.s. job applicants or employees": PERSON,
214
+ "Army and Air Force Exchange Service": OTHER,
215
+ "Atomic Energy Commission": PUBLIC_ENTITY,
216
+ "Secretary or administrative unit or personnel of the U.S. Air Force": PUBLIC_ENTITY,
217
+ "Department or Secretary of Agriculture": PUBLIC_ENTITY,
218
+ "Alien Property Custodian": OTHER,
219
+ "Secretary or administrative unit or personnel of the U.S. Army": PUBLIC_ENTITY,
220
+ "Board of Immigration Appeals": PUBLIC_ENTITY,
221
+ "Bureau of Indian Affairs": PUBLIC_ENTITY,
222
+ "Bonneville Power Administration": PUBLIC_ENTITY,
223
+ "Benefits Review Board": PUBLIC_ENTITY,
224
+ "Civil Aeronautics Board": PUBLIC_ENTITY,
225
+ "Bureau of the Census": PUBLIC_ENTITY,
226
+ "Central Intelligence Agency": PUBLIC_ENTITY,
227
+ "Commodity Futures Trading Commission": OTHER,
228
+ "Department or Secretary of Commerce": PUBLIC_ENTITY,
229
+ "Comptroller of Currency": OTHER,
230
+ "Consumer Product Safety Commission": PUBLIC_ENTITY,
231
+ "Civil Rights Commission": PUBLIC_ENTITY,
232
+ "Civil Service Commission, U.S.": PUBLIC_ENTITY,
233
+ "Customs Service or Commissioner of Customs": OTHER,
234
+ "Defense Base Closure and REalignment Commission": OTHER,
235
+ "Drug Enforcement Agency": PUBLIC_ENTITY,
236
+ "Department or Secretary of Defense (and Department or Secretary of War)": PUBLIC_ENTITY,
237
+ "Department or Secretary of Energy": PUBLIC_ENTITY,
238
+ "Department or Secretary of the Interior": PUBLIC_ENTITY,
239
+ "Department of Justice or Attorney General": PUBLIC_ENTITY,
240
+ "Department or Secretary of State": PUBLIC_ENTITY,
241
+ "Department or Secretary of Transportation": PUBLIC_ENTITY,
242
+ "Department or Secretary of Education": PUBLIC_ENTITY,
243
+ "U.S. Employees' Compensation Commission, or Commissioner": PUBLIC_ENTITY,
244
+ "Equal Employment Opportunity Commission": PUBLIC_ENTITY,
245
+ "Environmental Protection Agency or Administrator": PUBLIC_ENTITY,
246
+ "Federal Aviation Agency or Administration": PUBLIC_ENTITY,
247
+ "Federal Bureau of Investigation or Director": PUBLIC_ENTITY,
248
+ "Federal Bureau of Prisons": PUBLIC_ENTITY,
249
+ "Farm Credit Administration": PUBLIC_ENTITY,
250
+ "Federal Communications Commission (including a predecessor, Federal Radio Commission)": OTHER,
251
+ "Federal Credit Union Administration": PUBLIC_ENTITY,
252
+ "Food and Drug Administration": PUBLIC_ENTITY,
253
+ "Federal Deposit Insurance Corporation": PUBLIC_ENTITY,
254
+ "Federal Energy Administration": PUBLIC_ENTITY,
255
+ "Federal Election Commission": PUBLIC_ENTITY,
256
+ "Federal Energy Regulatory Commission": PUBLIC_ENTITY,
257
+ "Federal Housing Administration": PUBLIC_ENTITY,
258
+ "Federal Home Loan Bank Board": PUBLIC_ENTITY,
259
+ "Federal Labor Relations Authority": PUBLIC_ENTITY,
260
+ "Federal Maritime Board": PUBLIC_ENTITY,
261
+ "Federal Maritime Commission": PUBLIC_ENTITY,
262
+ "Farmers Home Administration": PUBLIC_ENTITY,
263
+ "Federal Parole Board": PUBLIC_ENTITY,
264
+ "Federal Power Commission": PUBLIC_ENTITY,
265
+ "Federal Railroad Administration": PUBLIC_ENTITY,
266
+ "Federal Reserve Board of Governors": PUBLIC_ENTITY,
267
+ "Federal Reserve System": PUBLIC_ENTITY,
268
+ "Federal Savings and Loan Insurance Corporation": PUBLIC_ENTITY,
269
+ "Federal Trade Commission": PUBLIC_ENTITY,
270
+ "Federal Works Administration, or Administrator": PUBLIC_ENTITY,
271
+ "General Accounting Office": PUBLIC_ENTITY,
272
+ "Comptroller General": OTHER,
273
+ "General Services Administration": PUBLIC_ENTITY,
274
+ "Department or Secretary of Health, Education and Welfare": PUBLIC_ENTITY,
275
+ "Department or Secretary of Health and Human Services": PUBLIC_ENTITY,
276
+ "Department or Secretary of Housing and Urban Development": PUBLIC_ENTITY,
277
+ "Interstate Commerce Commission": PUBLIC_ENTITY,
278
+ "Indian Claims Commission": PUBLIC_ENTITY,
279
+ "Immigration and Naturalization Service, or Director of, or District Director of, or Immigration and Naturalization Enforcement": PUBLIC_ENTITY,
280
+ "Internal Revenue Service, Collector, Commissioner, or District Director of": PUBLIC_ENTITY,
281
+ "Information Security Oversight Office": ORGANIZATION,
282
+ "Department or Secretary of Labor": PUBLIC_ENTITY,
283
+ "Loyalty Review Board": ORGANIZATION,
284
+ "Legal Services Corporation": ORGANIZATION,
285
+ "Merit Systems Protection Board": ORGANIZATION,
286
+ "Multistate Tax Commission": PUBLIC_ENTITY,
287
+ "National Aeronautics and Space Administration": PUBLIC_ENTITY,
288
+ "Secretary or administrative unit of the U.S. Navy": PUBLIC_ENTITY,
289
+ "National Credit Union Administration": PUBLIC_ENTITY,
290
+ "National Endowment for the Arts": PUBLIC_ENTITY,
291
+ "National Enforcement Commission": PUBLIC_ENTITY,
292
+ "National Highway Traffic Safety Administration": PUBLIC_ENTITY,
293
+ "National Labor Relations Board, or regional office or officer": PUBLIC_ENTITY,
294
+ "National Mediation Board": PUBLIC_ENTITY,
295
+ "National Railroad Adjustment Board": PUBLIC_ENTITY,
296
+ "Nuclear Regulatory Commission": PUBLIC_ENTITY,
297
+ "National Security Agency": PUBLIC_ENTITY,
298
+ "Office of Economic Opportunity": PUBLIC_ENTITY,
299
+ "Office of Management and Budget": PUBLIC_ENTITY,
300
+ "Office of Price Administration, or Price Administrator": PUBLIC_ENTITY,
301
+ "Office of Personnel Management": PUBLIC_ENTITY,
302
+ "Occupational Safety and Health Administration": PUBLIC_ENTITY,
303
+ "Occupational Safety and Health Review Commission": PUBLIC_ENTITY,
304
+ "Office of Workers' Compensation Programs": PUBLIC_ENTITY,
305
+ "Patent Office, or Commissioner of, or Board of Appeals of": PUBLIC_ENTITY,
306
+ "Pay Board (established under the Economic Stabilization Act of 1970)": PUBLIC_ENTITY,
307
+ "Pension Benefit Guaranty Corporation": PUBLIC_ENTITY,
308
+ "U.S. Public Health Service": PUBLIC_ENTITY,
309
+ "Postal Rate Commission": PUBLIC_ENTITY,
310
+ "Provider Reimbursement Review Board": PUBLIC_ENTITY,
311
+ "Renegotiation Board": PUBLIC_ENTITY,
312
+ "Railroad Adjustment Board": PUBLIC_ENTITY,
313
+ "Railroad Retirement Board": PUBLIC_ENTITY,
314
+ "Subversive Activities Control Board": PUBLIC_ENTITY,
315
+ "Small Business Administration": PUBLIC_ENTITY,
316
+ "Securities and Exchange Commission": PUBLIC_ENTITY,
317
+ "Social Security Administration or Commissioner": PUBLIC_ENTITY,
318
+ "Selective Service System": PUBLIC_ENTITY,
319
+ "Department or Secretary of the Treasury": PUBLIC_ENTITY,
320
+ "Tennessee Valley Authority": PUBLIC_ENTITY,
321
+ "United States Forest Service": PUBLIC_ENTITY,
322
+ "United States Parole Commission": PUBLIC_ENTITY,
323
+ "Postal Service and Post Office, or Postmaster General, or Postmaster": PUBLIC_ENTITY,
324
+ "United States Sentencing Commission": PUBLIC_ENTITY,
325
+ "Veterans' Administration": PUBLIC_ENTITY,
326
+ "War Production Board": PUBLIC_ENTITY,
327
+ "Wage Stabilization Board": PUBLIC_ENTITY,
328
+ "General Land Office of Commissioners": PUBLIC_ENTITY,
329
+ "Transportation Security Administration": PUBLIC_ENTITY,
330
+ "Surface Transportation Board": PUBLIC_ENTITY,
331
+ "U.S. Shipping Board Emergency Fleet Corp.": ORGANIZATION,
332
+ "Reconstruction Finance Corp.": ORGANIZATION,
333
+ "Department or Secretary of Homeland Security": PUBLIC_ENTITY,
334
+ "Unidentifiable": OTHER,
335
+ "International Entity": ORGANIZATION,
336
+ }
337
+
338
+ ISSUE_AREA_MAPPING = {k.lower().replace(" ", "_"): i for i, k in enumerate(ISSUE_AREAS)}
339
+
340
+ METADATA_FIELDS = ['decisionDirection', 'respondent']
341
+
342
+ @dataclass
343
+ class SCOTUSConfig(datasets.BuilderConfig):
344
+ version:str=None
345
+ name:str = None
346
+ extended_name: str = None
347
+
348
+
349
+ class ScotusDataset(datasets.GeneratorBasedBuilder):
350
+ BUILDER_CONFIGS = [
351
+ SCOTUSConfig(
352
+ name='scotus',
353
+ extended_name = 'Supreme Court of United States Dataset',
354
+ version=datasets.Version(_VERSION, ""),
355
+ )
356
+ ]
357
+
358
+ def _info(self) -> DatasetInfo:
359
+ return datasets.DatasetInfo(
360
+ description=_DESCRIPTION,
361
+ features=datasets.Features(
362
+ {
363
+ "id": datasets.Value("string"),
364
+ "text": datasets.Value("string"),
365
+ "decisionDirection": datasets.Value("string"),
366
+ "respondent":datasets.Value("string"),
367
+ 'label_ids': datasets.Value('int64'),
368
+ "labels": datasets.Value("string")
369
+ }
370
+ ),
371
+ supervised_keys=None,
372
+ )
373
+
374
+ def _split_generators(self, dl_manager: DownloadManager):
375
+ downloaded_file = dl_manager.download_and_extract(_DOWNLOAD_URL)
376
+ dataset_root_folder = os.path.join(downloaded_file)
377
+
378
+ return [
379
+ datasets.SplitGenerator(
380
+ name=datasets.Split.TRAIN,
381
+ # These kwargs will be passed to _generate_examples
382
+ gen_kwargs={
383
+ "dataset_root": dataset_root_folder,
384
+ "split": "train",
385
+ },
386
+ ),
387
+ datasets.SplitGenerator(
388
+ name=datasets.Split.VALIDATION,
389
+ # These kwargs will be passed to _generate_examples
390
+ gen_kwargs={
391
+ "dataset_root": dataset_root_folder,
392
+ "split": "dev",
393
+ },
394
+ ),
395
+ datasets.SplitGenerator(
396
+ name=datasets.Split.TEST,
397
+ # These kwargs will be passed to _generate_examples
398
+ gen_kwargs={
399
+ "dataset_root": dataset_root_folder,
400
+ "split": "test",
401
+ },
402
+ ),
403
+ ]
404
+
405
+ def _generate_examples(self, dataset_root, split, **kwargs):
406
+ path = os.path.join(dataset_root, 'scotus', f'scotus.{split}.jsonl')
407
+ with jsonlines.open(path) as lines:
408
+ for line in lines:
409
+ attributes = line['attributes']
410
+ iid = attributes['docketId']
411
+ text = line['text']
412
+ label = str(line['label'])
413
+ label_id = ISSUE_AREA_MAPPING[label]
414
+ respondent = RESPONDENT_MAPPING[attributes['respondent']]
415
+ yield iid, {'text': text, 'id': iid, 'labels':label, 'label_ids': label_id, 'decisionDirection': attributes['decisionDirection'], 'respondent': respondent}
416
+
417
+ if __name__ == '__main__':
418
+ from datasets import load_dataset
419
+ dataset = load_dataset('/home/npf290/dev/fairlex-wilds/huggingface_scotus/scotus.py')
420
+ dataset['train']
421
+ print()