> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chonkie.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Visualizer

> Visualize your chunks and embeddings

The `Visualizer` helps you visualize your chunks properly and compare different chunkers and settings with ease, either on the terminal or via HTML.

<img src="https://mintcdn.com/chonkie/z5jcWEi822NzVea9/assets/viz/viz-terminal.png?fit=max&auto=format&n=z5jcWEi822NzVea9&q=85&s=5628f92cb3e021a10f00c50e658a5ea1" alt="Visualizer Example" width="2056" height="896" data-path="assets/viz/viz-terminal.png" />

## Installation

To make use of the `Visualizer`, you'll need to install the `viz` optional install.

```bash theme={"system"}
pip install "chonkie[viz]"
```

## Usage

To use the `Visualizer`, you'll need to import it from `chonkie.utils`.

```python theme={"system"}
# Import the Visualizer
from chonkie import Visualizer

# Initialize the Visualizer
viz = Visualizer()
```

The `Visualizer` has two main methods: `print` and `save`.

The `print` method will print the chunks to the terminal. It accepts a list of `Chunk` objects or plain strings.

```python theme={"system"}
viz.print(chunks)

# Or you can directly call the Visualizer object
viz(chunks)

# You can also pass a list of plain strings
viz(["First text segment", "Second text segment", "Third text segment"])
```

The `save` method will save the chunks to a HTML file. Like `print`, it accepts `Chunk` objects or strings.

```python theme={"system"}
viz.save("chonkie.html", chunks)
```

<img src="https://mintcdn.com/chonkie/z5jcWEi822NzVea9/assets/viz/viz-html.png?fit=max&auto=format&n=z5jcWEi822NzVea9&q=85&s=523b12a9521db882a329ce05a2292037" alt="Visualizer Example" width="3624" height="2340" data-path="assets/viz/viz-html.png" />
