Datasets:
Upload reddit_climate_comment.py
Browse files
reddit_climate_comment.py
CHANGED
|
@@ -73,19 +73,12 @@ class NewDataset(GeneratorBasedBuilder):
|
|
| 73 |
post_permalink = post_data['PostPermalink']
|
| 74 |
|
| 75 |
comments = []
|
| 76 |
-
seen_comment_ids = set() # Set to keep track of seen comment IDs
|
| 77 |
|
| 78 |
for index, comment_row in group.iterrows():
|
| 79 |
comment_id = str(comment_row['CommentID'])
|
| 80 |
|
| 81 |
-
# Check if comment ID has been seen before
|
| 82 |
-
if comment_id in seen_comment_ids:
|
| 83 |
-
continue # Skip duplicate comments
|
| 84 |
-
else:
|
| 85 |
-
seen_comment_ids.add(comment_id)
|
| 86 |
-
|
| 87 |
comment = {
|
| 88 |
-
"
|
| 89 |
"CommentAuthor": comment_row['CommentAuthor'],
|
| 90 |
"CommentBody": comment_row['CommentBody'],
|
| 91 |
"CommentTimestamp": comment_row['CommentTimestamp'],
|
|
@@ -123,5 +116,6 @@ class NewDataset(GeneratorBasedBuilder):
|
|
| 123 |
"comments": comments
|
| 124 |
}
|
| 125 |
|
|
|
|
| 126 |
|
| 127 |
|
|
|
|
| 73 |
post_permalink = post_data['PostPermalink']
|
| 74 |
|
| 75 |
comments = []
|
|
|
|
| 76 |
|
| 77 |
for index, comment_row in group.iterrows():
|
| 78 |
comment_id = str(comment_row['CommentID'])
|
| 79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
comment = {
|
| 81 |
+
"id": comment_id,
|
| 82 |
"CommentAuthor": comment_row['CommentAuthor'],
|
| 83 |
"CommentBody": comment_row['CommentBody'],
|
| 84 |
"CommentTimestamp": comment_row['CommentTimestamp'],
|
|
|
|
| 116 |
"comments": comments
|
| 117 |
}
|
| 118 |
|
| 119 |
+
|
| 120 |
|
| 121 |
|