Complete the code to split the sentence into words using whitespace.
tokens = sentence.[1]()The split() method breaks a string into a list of words using whitespace by default.
Complete the code to create a vocabulary set from the list of tokens.
vocab = set([1])The set() function creates a collection of unique items from the list tokens.
Fix the error in the code to count the frequency of each token.
freq = {}
for token in tokens:
freq[token] = freq.get([1], 0) + 1tokens as the key.freq as the key.The get() method needs the current token as the key to get its count.
Fill both blanks to create a dictionary of token lengths for tokens longer than 3 characters.
lengths = {token: [1] for token in tokens if len(token) [2] 3}The dictionary comprehension maps each token to its length if the token length is greater than 3.
Fill all three blanks to create a frequency dictionary for tokens longer than 2 characters.
freq_filtered = {token: [1] for token in tokens if len(token) [2] 2 and token in [3]This comprehension creates a dictionary with tokens as keys and their frequencies as values, filtering tokens longer than 2 characters and present in the vocabulary set.