"""CollapseWhitespaceNormalizer --- collapses whitespace runs to single space."""

from __future__ import annotations

from .base import BaseNormalizer


class CollapseWhitespaceNormalizer(BaseNormalizer):
    """Collapses consecutive whitespace characters to a single space and strips
    leading/trailing whitespace.
    """

    def to_normalizer_spec(self) -> dict:
        return {"type": "collapse_whitespace", "config": {}}
