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

Exercise

POS tagging with spaCy

In this exercise, you will practice POS tagging. POS tagging is a useful tool in NLP as it allows algorithms to understand the grammatical structure of a sentence and to confirm words that have multiple meanings such as watch and play.

For this exercise, en_core_web_sm has been loaded for you as nlp. Three comments from the Airline Travel Information System (ATIS) dataset have been provided for you in a list called texts.

Instructions

100 XP
  • Compile documents, a list of all doc containers for each text in texts list using list comprehension.
  • For each doc container, print each token's text and its corresponding POS tag by iterating through documents and tokens of each doc container using a nested for loop.