November 2018
Beginner to intermediate
182 pages
4h 48m
English
The following lines of code simply segment or split the entire text body on space ' ':
words = text.split()print(len(words)) 107431
Let's preview a rather large segment from our list of tokens:
print(words[90:200]) #start with the first chapter, ignoring the index for now ['To', 'Sherlock', 'Holmes', 'she', 'is', 'always', 'THE', 'woman.', 'I', 'have', 'seldom', 'heard', 'him', 'mention', 'her', 'under', 'any', 'other', 'name.', 'In', 'his', 'eyes', 'she', 'eclipses', 'and', 'predominates', 'the', 'whole', 'of', 'her', 'sex.', 'It', 'was', 'not', 'that', 'he', 'felt', 'any', 'emotion', 'akin', 'to', 'love', 'for', 'Irene', 'Adler.', 'All', 'emotions,', 'and', 'that', 'one', 'particularly,', 'were', 'abhorrent', ...
Read now
Unlock full access