Created
June 16, 2018 21:06
-
-
Save MarynaLongnickel/f0f9f891f2adf24274a61f151fe2eed5 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
data = pd.DataFrame(columns=['text', 'sentiment']) | |
for id in movie_reviews.fileids(): | |
text = ' '.join(movie_reviews.words(id)) | |
sentiment = 1 if movie_reviews.categories(id) == 'pos' else 0 | |
data = data.append(pd.DataFrame({'text': text,'sentiment': sentiment}, index=[0])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment