Datasets:
Upload reddit_climate_comment.py
Browse files
reddit_climate_comment.py
CHANGED
|
@@ -69,13 +69,13 @@ class NewDataset(GeneratorBasedBuilder):
|
|
| 69 |
post_permalink = post['PostPermalink']
|
| 70 |
comments = []
|
| 71 |
|
| 72 |
-
for i in range(
|
| 73 |
-
comment_id = post['Comments']['CommentID']
|
| 74 |
-
comment_author = post['Comments']['CommentAuthor']
|
| 75 |
-
comment_body = post['Comments']['CommentBody']
|
| 76 |
-
comment_timestamp = post['Comments']['CommentTimestamp']
|
| 77 |
-
comment_upvotes = int(post['Comments']['CommentUpvotes']
|
| 78 |
-
comment_permalink = post['Comments']['CommentPermalink']
|
| 79 |
replies = []
|
| 80 |
comments.append({
|
| 81 |
"CommentID": comment_id,
|
|
|
|
| 69 |
post_permalink = post['PostPermalink']
|
| 70 |
comments = []
|
| 71 |
|
| 72 |
+
for i in range(len(post['Comments'])):
|
| 73 |
+
comment_id = post['Comments'][i]['CommentID']
|
| 74 |
+
comment_author = post['Comments'][i]['CommentAuthor']
|
| 75 |
+
comment_body = post['Comments'][i]['CommentBody'] if post['Comments'][i]['CommentBody'] != "" else None
|
| 76 |
+
comment_timestamp = post['Comments'][i]['CommentTimestamp']
|
| 77 |
+
comment_upvotes = int(post['Comments'][i]['CommentUpvotes']) if post['Comments'][i]['CommentUpvotes'] else None
|
| 78 |
+
comment_permalink = post['Comments'][i]['CommentPermalink']
|
| 79 |
replies = []
|
| 80 |
comments.append({
|
| 81 |
"CommentID": comment_id,
|