- 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 - Util.filter_spans
This utility function was introduced in version 2.0. It will filter a sequence of span objects and also removes the duplicates. This function is very useful for creating the named entities.
Argument
The table below explains its argument −
NAME | TYPE | DESCRIPTION |
---|---|---|
spans | iterable | It represents the spans to filter. |
Example
An example of util.filter_spans() function is as follows −
import spacy text = nlp("This is Tutorialspoint.com.") spans = [text[0:2], text[0:2], text[0:4]] filtered_document = spacy.util.filter_spans(spans) filtered_document
Output
You will receive the following output −
[This is Tutorialspoint.com.]
spacy_util_get_data_path.htm
Advertisements
To Continue Learning Please Login
Login with Google