Datasets:

srzhang commited on
Commit
3abd101
·
1 Parent(s): 9899651
Files changed (1) hide show
  1. LongConL.py +33 -37
LongConL.py CHANGED
@@ -30,8 +30,6 @@ _CONFIGS = {
30
  for task_name in TASK_NAMES
31
  }
32
 
33
-
34
-
35
  class LongConLDataset(datasets.GeneratorBasedBuilder):
36
  """Legal opinion classification dataset for LongConL tasks"""
37
 
@@ -73,39 +71,37 @@ class LongConLDataset(datasets.GeneratorBasedBuilder):
73
  ),
74
  ]
75
 
76
- def _generate_examples(self, file_path):
77
- """Generate examples from the dataset CSV."""
78
- data = pd.read_csv(file_path)
79
- print("Data loaded from file:", file_path)
80
- print(data.head()) # Display first few rows
81
-
82
- # Check if the DataFrame is empty or has the correct columns
83
- if data.empty:
84
- print(f"Warning: No data found in {file_path}")
85
- return # Early exit if there's no data
86
-
87
- expected_columns = {"Citation", "Full Case Name", "Opinion Text", "Numerical Label", "Text Label"}
88
- if not expected_columns.issubset(data.columns):
89
- print(f"Warning: Missing columns in {file_path}. Expected columns: {expected_columns}. Found columns: {set(data.columns)}")
90
- return # Early exit if columns are missing
91
-
92
- data_dict = data.to_dict(orient="records")
93
- print(f"Number of examples to generate: {len(data_dict)}")
94
-
95
- for id_, row in enumerate(data_dict):
96
- yield id_, {
97
- "Citation": row["Citation"],
98
- "Full Case Name": row["Full Case Name"],
99
- "Opinion Text": row["Opinion Text"],
100
- "Numerical Label": row.get("Numerical Label", None),
101
- "Text Label": row["Text Label"],
102
- }
103
-
104
-
105
- # Use a dynamic config
106
- BUILDER_CONFIGS = [
107
- datasets.BuilderConfig(name=task_name, version=datasets.Version("1.0.0"), description=task_name)
108
- for task_name in ["ATS-Jurisdiction", "ATS-FavorableJudgment","JRC-AREA1","DC-category", "SC-issueArea","SSC-ca_disp", "Chevron-Agency","CoA-geniss"] # Add your task names here
109
- ]
110
-
111
 
 
30
  for task_name in TASK_NAMES
31
  }
32
 
 
 
33
  class LongConLDataset(datasets.GeneratorBasedBuilder):
34
  """Legal opinion classification dataset for LongConL tasks"""
35
 
 
71
  ),
72
  ]
73
 
74
+ def _generate_examples(self, file_path):
75
+ """Generate examples from the dataset CSV."""
76
+ data = pd.read_csv(file_path)
77
+ print("Data loaded from file:", file_path)
78
+ print(data.head()) # Display first few rows
79
+
80
+ # Check if the DataFrame is empty or has the correct columns
81
+ if data.empty:
82
+ print(f"Warning: No data found in {file_path}")
83
+ return # Early exit if there's no data
84
+
85
+ expected_columns = {"Citation", "Full Case Name", "Opinion Text", "Numerical Label", "Text Label"}
86
+ if not expected_columns.issubset(data.columns):
87
+ print(f"Warning: Missing columns in {file_path}. Expected columns: {expected_columns}. Found columns: {set(data.columns)}")
88
+ return # Early exit if columns are missing
89
+
90
+ data_dict = data.to_dict(orient="records")
91
+ print(f"Number of examples to generate: {len(data_dict)}")
92
+
93
+ for id_, row in enumerate(data_dict):
94
+ yield id_, {
95
+ "Citation": row["Citation"],
96
+ "Full Case Name": row["Full Case Name"],
97
+ "Opinion Text": row["Opinion Text"],
98
+ "Numerical Label": row.get("Numerical Label", None),
99
+ "Text Label": row["Text Label"],
100
+ }
101
+
102
+ # Use a dynamic config
103
+ BUILDER_CONFIGS = [
104
+ datasets.BuilderConfig(name=task_name, version=datasets.Version("1.0.0"), description=task_name)
105
+ for task_name in ["ATS-Jurisdiction", "ATS-FavorableJudgment", "JRC-AREA1", "DC-category", "SC-issueArea", "SSC-ca_disp", "Chevron-Agency", "CoA-geniss"] # Add your task names here
106
+ ]
 
 
107