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

Exercise

NER with spaCy

Named entity recognition (NER) helps you to easily identify key elements of a given document, like names of people and places. It helps sort unstructured data and detect important information, which is crucial if you are dealing with large datasets. In this exercise, you will practice Named Entity Recognition.

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 the texts using list comprehension.
  • For each doc container, print each entity's text and corresponding label by iterating through doc.ents.
  • Print the sixth token's text, and the entity type of the second Doc container.