In the pre-processing step, I see this block of code:
# split by new lines and spaces
reviews_split = all_text.split('\n')
all_text = ' '.join(reviews_split)
# create a list of words
words = all_text.split()
that can be simplified to
# split by new lines and spaces
reviews_split = all_text.split('\n')
# create a list of words
words = all_text.split()
In the pre-processing step, I see this block of code:
that can be simplified to
(https://github.com/goelakash/deep-learning-v2-pytorch/blob/master/sentiment-rnn/Sentiment_RNN_Exercise.ipynb)
Both spaces and newlines are treated as same. Hence we can remove the redundant code.
See for reference: python2 python3