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

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2
from ..core.unchecked_base_model import UncheckedBaseModel
from .transcription_word_type import TranscriptionWordType


class TranscriptionWord(UncheckedBaseModel):
    """
    Word-level transcription data with timing information.
    """

    text: typing.Optional[str] = pydantic.Field(default=None)
    """
    The transcribed word.
    """

    start: typing.Optional[float] = pydantic.Field(default=None)
    """
    Start time in seconds.
    """

    end: typing.Optional[float] = pydantic.Field(default=None)
    """
    End time in seconds.
    """

    type: typing.Optional[TranscriptionWordType] = pydantic.Field(default=None)
    """
    The type of word.
    """

    speaker_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The ID of the speaker if available.
    """

    logprob: typing.Optional[float] = pydantic.Field(default=None)
    """
    Confidence score for this word.
    """

    characters: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
    """
    The characters in the word.
    """

    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
