- 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.sents Property
As name suggests, this doc property is used to iterate over the sentences in a particular document. If the parser is disabled, then the sents iterator will be unavailable.
Example 1
Refer the example of Doc.sents property given below −
import spacy nlp_model = spacy.load("en_core_web_sm") doc = nlp_model("The website is Tutorialspoint.com. It is having best technical tutorials.") sents = list(doc.sents) len(sents)
Output
You will get the following output −
2
Example 2
An another example of Doc.sents property is given below −
[a.root.text for a in sents]
Output
['is', 'having']
spacy_doc_class_contextmanager_and_property.htm
Advertisements