1. Learn
  2. /
  3. Courses
  4. /
  5. Natural Language Processing with spaCy

Exercise

Word-sense disambiguation with spaCy

WSD is a classical problem of deciding in which sense a word is used in a sentence. Determining the sense of the word can be crucial in search engines, machine translation, and question-answering systems. In this exercise, you will practice using POS tagging for word-sense disambiguation.

There are two sentences containing the word jam, with two different senses and you are tasked to identify the POS tags to help you determine the corresponding sense of the word in a given sentence.

The two sentences are available in the texts list. The en_core_web_sm model is already loaded and available for your use as nlp.

Instructions 1/2

undefined XP
    1
    2
  • Create a documents list containing the Doc containers of each element in the texts list.
  • Print a tuple of the token's text and POS tags per each Doc container only if the word jam is in the token text.