I was trying with the below code and got the error:
def preprocess(s):
return (word: True for word in s.lower().split())
s1 = 'This is a book'
text = preprocess(s1)
And then here comes the error that
return (word: True for word in s.lower().split())
is invalid syntax. I cannot find where the error comes from.
I want to put the sequence into this list model:
["This": True, "is" : True, "a" :True, "book": True]