in this section, we will build an LSTM model to learn sequences of words
from email data. We will use this model to predict the next word.
file_content = pd.read_csv(‘spam.csv’, encoding = “ISO-8859-1”)
#Just selecting emails and connverting it into list
Email_Data = file_content[[ ‘v2’]]
list_data = Email_Data.values.tolist()
list_data
#output
[[ ‘Go until jurong point, crazy… Available only in bugis n
great world la e buffet… Cine there got amore wat…’],
[‘Ok lar… Joking wif u oni…’],
[ “Free entry in 2 a wkly comp to win FA Cup final tkts 21st
May 2005. Text FA to 87121 to receive entry question(std txt
rate)T&C’s apply 08452810075over18’s”],
[‘U dun say so early hor… U c already then say…’],
[“Nah I don’t think he goes to usf, he lives around here though”],
[" FreeMsg Hey there darling it’s been 3 week’s now and no word
back! I’d like some fun you up for it still? Tb ok! XxX std
chgs to send, å£1.50 to rcv"],
[’ Even my brother is not like to speak with me. They treat me
like aids patent.’],
[" As per your request ‘Melle Melle (Oru Minnaminunginte
Nurungu Vettam)’ has been set as your callertune for all
Callers. Press *9 to copy your friends Callertune"],
Chapter 6 Deep Learning for nLp
221
[ ‘WINNER!! As a valued network customer you have been selected
to receivea å£900 prize reward! To claim call 09061701461.
Claim code KL341. Valid 12 hours only.’] ,
[ ‘Had your mobile 11 months or more? U R entitled to Update
to the latest colour mobiles with camera