- spaCy Tutorial
- spaCy - Home
- spaCy - Introduction
- spaCy - Getting Started
- spaCy - Models and Languages
- spaCy - Architecture
- spaCy - Command Line Helpers
- spaCy - Top-level Functions
- spaCy - Visualization Function
- spaCy - Utility Functions
- spaCy - Compatibility Functions
- spaCy - Containers
- Doc Class ContextManager and Property
- spaCy - Container Token Class
- spaCy - Token Properties
- spaCy - Container Span Class
- spaCy - Span Class Properties
- spaCy - Container Lexeme Class
- Training Neural Network Model
- Updating Neural Network Model
- spaCy Useful Resources
- spaCy - Quick Guide
- spaCy - Useful Resources
- spaCy - Discussion
spaCy - Doc.ents Property
This doc property is used for the named entities in the document. If the entity recognizer has been applied, this property will return a tuple of named entity span objects.
Example 1
An example of Doc.ents property is as follows −
import spacy nlp_model = spacy.load("en_core_web_sm") doc = nlp_model("This is Tutorialspoint.com.") ents = list(doc.ents) ents[0].label
Output
When you execute the code, you will see the following output −
383
Example 2
Here is an another example of Doc.ents property −
ents[0].label_
Output
‘ORG’
Example 3
Given below is an example of Doc.ents property −
ents[0].text
Output
'Tutorialspoint.com'
spacy_doc_class_contextmanager_and_property.htm
Advertisements