Hi all,
I am stuck at the same code segment.
It so far seems to work, however, the notebook throws an error
KeyError: ‘love’
Even though the notebook seems to work well (All tests passed), the grader score is 0. The grader output is:
### START CODE HERE ###
# Step 1: Split sentence into list of lower case words (≈ 1 line)
words = sentence.lower().split()
# Initialize the average word vector, should have the same shape as your word vectors.
avg = np.zeros(word_to_vec_map[any_word].shape)
# Initialize count to 0
count = 0
# Step 2: average the word vectors. You can loop over the words in the list "words".
for w in words:
# Check that word exists in word_to_vec_map
if w in words:
avg += word_to_vec_map[w]
# Increment count
count +=1
if count > 0:
# Get the average. But only if count > 0
avg = avg/len(words)
### END CODE HERE ###
Cell #13. Can’t compile the student’s code. Error: KeyError(‘never’,)
I have no idea what causes this. Any help appreciated