Created
August 2, 2020 14:43
-
-
Save kipronokoech/d5bfca20d9db1d89af99b043018bbab3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Most of the cleaning was done during the data web scraping | |
# Find the notebook here | |
# https://github.com/kipronokoech/Reviews-Classification/blob/master/data_collection.ipynb | |
reviews = [] | |
with open("./data/reviews.txt") as fp: | |
for index,line in enumerate(fp): | |
# line is a strong on loading so we need to convert to dictionary | |
review = ast.literal_eval(line) | |
#categorize the review and append it to reviews | |
reviews.append(Review(review['reviewBody'], review['stars'])) | |
# print out the text and the sentiment category of review[0] | |
print(reviews[0].text) | |
print(reviews[0].sentiment) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment