%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/orca/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/orca/__pycache__/ssml.cpython-312.pyc

�

g
f���t�dZdZdZdZdZdZdZddlmZm	Z	d	d
l
mZd	dl
mZGd�d
e�Z
Gd�de�Zy)z�SSML --- XML-based markup language for speech synthesis.

Class SSML defines a simple wrapper for holding and converting
text to SSML, suitable to be sent to a speech server. Services
can pass flags to control the elements and attributes used.
z$Id$z
$Revision$z$Date$z<andyholmes@gnome.org>u(Copyright © 2024 GNOME Foundation Inc. �LGPL�)�Enum�auto�)�debug)�script_managerc��eZdZdZe�Ze�Ze�Ze�Ze�Z	e�Z
e�Ze�Ze�Z
e�Ze�Ze�Ze�Ze�Ze�Ze�Ze�Zy)�SSMLCapabilitiesz!Enumeration of SSML capabilities.N)�__name__�
__module__�__qualname__�__doc__r�SAY_AS_DATE�SAY_AS_TIME�SAY_AS_TELEPHONE�SAY_AS_CHARACTERS�SAY_AS_CHARACTERS_GLYPHS�SAY_AS_CARDINAL�SAY_AS_ORDINAL�SAY_AS_CURRENCY�BREAK�SUB�PHONEME�EMPHASIS�PROSODY�MARK�SENTENCE_PARAGRAPH�TOKEN�ALL���+/usr/lib/python3/dist-packages/orca/ssml.pyr
r
)s���+��&�K��&�K��v�����#�v���f�O��V�N��f�O��F�E�
�&�C��f�G��v�H��f�G��6�D�����F�E�
�&�Cr!r
c�z�eZdZdZdej
fd�Zd�Zed��Z	eej
fd��Z
d�Zd�Zy	)
�SSMLz*Holds SSML representation of an utterance.�c�\�tj|�|xsd|d<t|�|d<y)z%Create and initialize ACSS structure.r%�text�featuresN)�dict�__init__r
)�selfr'r(s   r"r*z
SSML.__init__@s*���
�
�d���z�r��V��+�H�5��Z�r!c��t|t�sy|jd�|jd�k7ry|jd�|jd�k7ryy)NFr'r(T)�
isinstancer$�get)r+�others  r"�__eq__zSSML.__eq__FsL���%��&���8�8�F��u�y�y��0�0���8�8�J��5�9�9�Z�#8�8��r!c��d}g}d}d}tt|��D�]}||}|dk(r�|j�s|�|dz
}|}|j�}n�|j�r�|��|r�t|dzt|��D]}||j�r�nd}|r_t|�krQ||j�s>||j�sd}|dz
}|r"|t|�kr||j�s�>|s,|j	||f�d}d}n|r|j�sd}||z
}��|�|j	|dzf�||fS)z3Mark the word offsets of text for later formatting.r%N�rF)�range�len�isspace�	isnumeric�append)r'�marked�offsets�
last_begin�
is_numeric�i�c�js        r"�_mark_wordszSSML._mark_wordsOsl�������
��
��s�4�y�!�&	�A��Q��A��H�}���9�9�;�:�#5��(�"���
��[�[�]�
������!7��#�1�Q�3��D�	�2�+��#�A�w���0�!�+�&+�
�$��S��Y��t�A�w���?P�#�A�w�0�0�2�).�J��Q���%��S��Y��t�A�w���?P�
"��N�N�J��?�3�!%�J�!%�J��A�K�K�M�"�
��a�K�F�M&	�P�!��N�N�J��A��.�/��� � r!c���|xsd}|dk(r|Stj|�\}}tj�j	�}|�|j
j
|�}d}d}|D]w}|dk(rJ|t|�k\r+|�d�}tjtj|d�n|d||zz
}|dz
}�R|d	k(r|d
z
}�]|dk(r|dz
}�h|d
k(r|dz
}�s||z
}�y|dz
}|S)a�Converts plain text to SSML markup.  If features is 0, the text
        will be returned unmodified.

        Arguments:
        - text:      optional text to add to the queue before speaking
        - features:  ssml.SSMLCapabilities flags. Currently, the only
                     supported element is SSMLCapabilities.MARK.

        Returns:
        - The SSML markup of the text, per the supported features.
        r%rz<speak>r2z+th U+E000 does not have corresponding indexTz<mark name="%u:%u"/>r�<z&lt;�>z&gt;�&z&amp;z</speak>)r$r?r�
getManager�getActiveScript�	utilities�adjustForPronunciationr4r�printMessage�
LEVEL_WARNING)r'r(r9�script�ssmlr<r=�msgs        r"�
markupTextzSSML.markupText�s ���z�r���q�=��K��*�*�4�0���w� �*�*�,�<�<�>�����#�#�:�:�4�@�D�
��
���	�A��H�}���G��$��C�J�K�C��&�&�u�':�':�C��F��2�W�Q�Z�?�?�D��Q����c�������c�������c��������	��+	�,	
�
����r!c�:�tj|d|d�S)z;Return the text content as SSML, per the supported featuresr'r()r$rM�r+s r"�	getMarkupzSSML.getMarkup�s�����t�F�|�T�*�-=�>�>r!c��|dS)Nr'r rOs r"�getTextzSSML.getText�s���F�|�r!N)
rrr
rr
rr*r0�staticmethodr?rMrPrRr r!r"r$r$=sX��4��)9�)=�)=�6���8!��8!�t�"2�"6�"6�6��6�p?�r!r$N)r�__id__�__version__�__date__�
__author__�
__copyright__�__license__�enumrrr%rrr
r)r$r r!r"�<module>r[sM��,�
������(�
�:�
�������t��(K�4�Kr!

Zerion Mini Shell 1.0