2

You could indeed utilise the Python's build-in Set type, although not compulsory, together with its intersection method for the purpose of filtering within all three functions. However, the use of sent_tokenize is imperative as the manual implantation of its equivalent would be bit more complex and is out of scope for the problem set. The outlined ...


1

the TL;DR: is that sent.tokenize() wants you to send it a string of English text, and it will spit back a list of the sentences contained in that long string (aka a list of strings). See here for an accessible overview of the tokenizing functions of NLTK. so if I have a string of text >>> string = "Python is cool. Python is fun. Python is great." ...


1

Are you sure it's adding a space, and you're not just printing a space using print? Consider print('token: "{}"'.format(token)) Added " so it's clear where the token begins and ends. Is there an extra space?


1

As far as I can tell, punctuation. "Hip Hip Hooray!".split() would return a list of 3 tokens (['Hip','Hip','Hooray!']). tokenize("Hip Hip Hooray!") returns a list of 4 tokens (['Hip', 'Hip', 'Hooray','!']). You can find the doc here. In the context of this exercise, each token is a string. This SE post will give you a broader view of the term.


Only top voted, non community-wiki answers of a minimum length are eligible