Data Visualization
Data visualization module for exploring SpaCy datasets.
This module provides functionality to visualize SpaCy NER and text classification datasets using SpaCy’s displacy server and custom HTML visualization.
- class spacylize.visualizer.DataVisualizer(input_path, task=None, n_samples=5, port=5002)[source]
Bases:
objectVisualizer for SpaCy datasets.
Loads a SpaCy dataset and serves an interactive visualization. Supports both NER (using displacy) and text classification (custom HTML).
- Parameters:
input_path (Path)
task (str)
n_samples (int)
port (int)
- input_path
Path to the SpaCy dataset file (.spacy).
- task
The SpaCy task type (‘ner’ or ‘textcat’).
- n_samples
Number of samples to visualize.
- port
Port number for the server.
- __init__(input_path, task=None, n_samples=5, port=5002)[source]
Initialize the DataVisualizer.
- Parameters:
input_path (Path) – Path to the SpaCy data file (.spacy).
task (str) – Optional task type (‘ner’ or ‘textcat’). Auto-detects if not specified.
n_samples (int) – Number of samples to visualize. Defaults to 5.
port (int) – Port to serve the visualization. Defaults to 5002.
- Raises:
FileNotFoundError – If the input file does not exist.
ValueError – If the task is invalid or cannot be detected.