yes-man-today
commited on
Commit
•
7a12b1c
1
Parent(s):
4e7e1de
May need to confirm that the dict list thing is okay
Browse files- regulatory_comments.py +28 -70
regulatory_comments.py
CHANGED
@@ -80,80 +80,38 @@ class RegComments(datasets.GeneratorBasedBuilder):
|
|
80 |
),
|
81 |
]
|
82 |
|
83 |
-
# def _generate_examples(self, filepath):
|
84 |
-
# """This function returns the examples in the raw (text) form."""
|
85 |
-
# print("enter generate")
|
86 |
-
# key = 0
|
87 |
-
# with open(filepath, 'r', encoding='utf-8') as f:
|
88 |
-
# data = json.load(f)
|
89 |
-
# for docket in data:
|
90 |
-
# docket_id = docket["id"]
|
91 |
-
# docket_title = docket["title"]
|
92 |
-
# docket_context = docket["context"]
|
93 |
-
# docket_purpose = docket.get("purpose", "unspecified")
|
94 |
-
# docket_keywords = docket.get("keywords", [])
|
95 |
-
# comments = docket["comments"]
|
96 |
-
# # for comment in docket["comments"]:
|
97 |
-
# # comment_data = {
|
98 |
-
# # "text": comment["text"],
|
99 |
-
# # "comment_id": comment["comment_id"],
|
100 |
-
# # "comment_url": comment["comment_url"],
|
101 |
-
# # "comment_date": comment["comment_date"],
|
102 |
-
# # "comment_title": comment["comment_title"],
|
103 |
-
# # "commenter_fname": comment["commenter_fname"],
|
104 |
-
# # "commenter_lname": comment["commenter_lname"],
|
105 |
-
# # "comment_length": comment["comment_length"]
|
106 |
-
# # }
|
107 |
-
# # comments.append(comment_data)
|
108 |
-
|
109 |
-
# yield key, {
|
110 |
-
# "id": docket_id,
|
111 |
-
# "title": docket_title,
|
112 |
-
# "context": docket_context,
|
113 |
-
# "purpose": docket_purpose,
|
114 |
-
# "keywords": docket_keywords,
|
115 |
-
# "comments": comments
|
116 |
-
# }
|
117 |
-
# key += 1
|
118 |
def _generate_examples(self, filepath):
|
119 |
-
"""
|
120 |
-
print("
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
|
|
128 |
docket_keywords = docket.get("keywords", [])
|
129 |
-
|
130 |
-
#
|
131 |
-
|
132 |
-
|
133 |
-
#
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
|
143 |
yield key, {
|
144 |
"id": docket_id,
|
145 |
"title": docket_title,
|
146 |
"context": docket_context,
|
147 |
-
"purpose": docket_purpose,
|
148 |
-
"keywords": docket_keywords,
|
149 |
-
"comments":
|
150 |
-
|
151 |
-
|
152 |
-
"comment_url": comment_urls,
|
153 |
-
"comment_date": comment_dates,
|
154 |
-
"comment_title": comment_titles,
|
155 |
-
"commenter_fname": commenter_fnames,
|
156 |
-
"commenter_lname": commenter_lnames,
|
157 |
-
"comment_length": comment_lengths
|
158 |
-
}
|
159 |
-
}
|
|
|
80 |
),
|
81 |
]
|
82 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
def _generate_examples(self, filepath):
|
84 |
+
"""This function returns the examples in the raw (text) form."""
|
85 |
+
print("enter generate")
|
86 |
+
key = 0
|
87 |
+
with open(filepath, 'r', encoding='utf-8') as f:
|
88 |
+
data = json.load(f)
|
89 |
+
for docket in data:
|
90 |
+
docket_id = docket["id"]
|
91 |
+
docket_title = docket["title"]
|
92 |
+
docket_context = docket["context"]
|
93 |
+
docket_purpose = docket.get("purpose", "unspecified")
|
94 |
docket_keywords = docket.get("keywords", [])
|
95 |
+
comments = docket["comments"]
|
96 |
+
# for comment in docket["comments"]:
|
97 |
+
# comment_data = {
|
98 |
+
# "text": comment["text"],
|
99 |
+
# "comment_id": comment["comment_id"],
|
100 |
+
# "comment_url": comment["comment_url"],
|
101 |
+
# "comment_date": comment["comment_date"],
|
102 |
+
# "comment_title": comment["comment_title"],
|
103 |
+
# "commenter_fname": comment["commenter_fname"],
|
104 |
+
# "commenter_lname": comment["commenter_lname"],
|
105 |
+
# "comment_length": comment["comment_length"]
|
106 |
+
# }
|
107 |
+
# comments.append(comment_data)
|
108 |
|
109 |
yield key, {
|
110 |
"id": docket_id,
|
111 |
"title": docket_title,
|
112 |
"context": docket_context,
|
113 |
+
"purpose": docket_purpose,
|
114 |
+
"keywords": docket_keywords,
|
115 |
+
"comments": comments
|
116 |
+
}
|
117 |
+
key += 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|