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

Exercise

EntityRuler with blank spaCy model

EntityRuler lets you to add entities to doc.ents. It can be combined with EntityRecognizer, a spaCy pipeline component for named-entity recognition, to boost accuracy, or used on its own to implement a purely rule-based entity recognition system. In this exercise, you will practice adding an EntityRuler component to a blank spaCy English model and classify named entities of the given text using purely rule-based named-entity recognition.

The spaCy package is already imported and a blank spaCy English model is ready for your use as nlp. A list of patterns to classify lower cased OpenAI and Microsoft as ORG is already created for your use.

Instructions

100 XP
  • Create and add an EntityRuler component to the pipeline.
  • Add given patterns to the EntityRuler component.
  • Run the model on the given text and create its corresponding Doc container.
  • Print a tuple of (entities text and types) for all entities in the Doc container