
    rHJj7                     B    d Z ddlmZmZ  G d d      Z eddd      Zy)	z2Provides the Separator tuple and its default value    )OptionalUnionc                       e Zd ZdZ	 	 	 ddedee   dee   fdZddZd Ze	d	        Z
e	d
        Ze	d        ZdefdZdeeef   deeef   fdZy)	Separatorz0Defines phone, syllable and word boundary tokensNwordsyllablephonec                 B   t        d |||fD              }t        d |||fD              }t        |      t        |      k7  rt        dj	                  |||            |rt        |      nd| _        |rt        |      nd| _        |rt        |      | _        y d| _        y )Nc              3   &   K   | ]	  }|s|  y wN .0seps     ^/Users/ahmed/devFolder/claude-voice/.venv/lib/python3.12/site-packages/phonemizer/separator.py	<genexpr>z%Separator.__init__.<locals>.<genexpr>   s     B#:CcC#:   c              3   &   K   | ]	  }|s|  y wr   r   r   s     r   r   z%Separator.__init__.<locals>.<genexpr>   s     A"93S3"9r   zcillegal separator with word="{}", syllable="{}" and phone="{}", must be all differents if not empty )	listsetlen
ValueErrorformatstr_phone	_syllable_word)selfr   r   r	   sep1sep2s         r   __init__zSeparator.__init__   s     BE8T#:BBA5(D"9AAt9D	!BVE8T24 4
 %*c%jr*2X"&SY
B
    c                     | j                   |j                   k(  xr4 | j                  |j                  k(  xr | j                  |j                  k(  S r   r	   r   r   )r   others     r   __eq__zSeparator.__eq__&   sA    

ekk) ,MMU^^3,II+	-r#   c                 V    d| j                    d| j                   d| j                   dS )Nz	(phone: "z", syllable: "z
", word: "z")r%   r   s    r   __str__zSeparator.__str__,   s5    

| $-- )ii[$	%r#   c                     | j                   S )zPhones separator)r   r)   s    r   r	   zSeparator.phone2   s     {{r#   c                     | j                   S )zSyllables separator)r   r)   s    r   r   zSeparator.syllable7   s     ~~r#   c                     | j                   S )zWords separator)r   r)   s    r   r   zSeparator.word<   s     zzr#   valuec                 L    || j                   | j                  | j                  hv S )z=Returns True if the separator has `value` as token separationr%   )r   r.   s     r   __contains__zSeparator.__contains__A   s     T]]DII>>>r#   field_separatorreturnc                     |syt        |t              r|| v rt        d| d|        |S |du rd}|| v r
|dz  }|| v r
|S t        d|       )a  Returns a suitable input/output separator based on token separator

        The input/output separator split orthographic and phonetic texts when
        using the --prepend-text option from command-line.

        Parameters
        ----------

        field_separator: bool or str
            If str, ensures it's value is not
            already defined as a token separator. If True choose one of "|",
            "||", "|||", "||||" (the first one that is not defined as a token
            separator)

        Returns
        -------
        The input/output separator, or False if ``field_separator`` is False

        Raises
        ------
        RuntimeError
            if ``field_separator`` is a str but is already registered as token separator

        Fzcannot prepend input with "z+" because it is already a token separator: T|z:invalid input/output separator, must be bool or str but is)
isinstancer   RuntimeError)r   r1   s     r   input_output_separatorz Separator.input_output_separatorE   s    4 os+$&"1/1B C88<v?@ @ #"d"!O!T)3& "T)"" H!" 	"r#   ) NN)r&   r   )__name__
__module____qualname____doc__r   r   r"   r'   r*   propertyr	   r   r   r0   r   boolr7   r   r#   r   r   r      s    :#&+/(,/S /#C=/ / -%      ?# ?-"eCI6F -"S$Y-"r#   r   r   r8   r%   N)r<   typingr   r   r   default_separatorr   r#   r   <module>rA      s.    9 "_" _"D B#>  Ir#   