# This file was auto-generated by Fern from our API Definition.

from ..core.pydantic_utilities import UniversalBaseModel
import typing
import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class SentenceSplitter(UniversalBaseModel):
    """
    Parse text with a preference for complete sentences.

    In general, this class tries to keep sentences and paragraphs together. Therefore
    compared to the original TokenTextSplitter, there are less likely to be
    hanging sentences or parts of sentences at the end of the node chunk.
    """

    include_metadata: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Whether or not to consider metadata when splitting.
    """

    include_prev_next_rel: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Include prev/next node relationships.
    """

    callback_manager: typing.Optional[typing.Optional[typing.Any]] = None
    id_func: typing.Optional[str] = pydantic.Field(default=None)
    """
    Function to generate node IDs.
    """

    chunk_size: typing.Optional[int] = pydantic.Field(default=None)
    """
    The token chunk size for each chunk.
    """

    chunk_overlap: typing.Optional[int] = pydantic.Field(default=None)
    """
    The token overlap of each chunk when splitting.
    """

    separator: typing.Optional[str] = pydantic.Field(default=None)
    """
    Default separator for splitting into words
    """

    paragraph_separator: typing.Optional[str] = pydantic.Field(default=None)
    """
    Separator between paragraphs.
    """

    secondary_chunking_regex: typing.Optional[str] = pydantic.Field(default=None)
    """
    Backup regex for splitting into sentences.
    """

    class_name: typing.Optional[str] = None

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
