C1_W4_Assignment function get_document_embedding embedding input issue

When creating a post, please add:

  • Week # must be added in the tags option of the post.
    Week 4 programming assignment
  • Link to the classroom item you are referring to:
  • Description (include relevant info but please do not post solution code or your entire notebook)
    Help needed to find the right input file (English embedding).
    When trying to run through function get_document_embedding with the English embedding file it return errors because there are certain ‘keywords’ cannot be found in the input file. For example in the picture below. Tweets without those keywords processed fine.

Hi @zzstephen

You should be using the dictionary’s .get() method to account for cases when the key does not exist. For example, en_embeddings.get(word, 0).


Thanks a lot! It works