Ë
    ÿÍ:jf  ã                   ó˜   — d dl Z d dlZd dlmZ d dlmZmZmZmZ d dl	m
Z
 d dlmZ dddœZh d	£Zd
ee   dedee   fd„Z G d„ de
«      Zy)é    N)ÚPath)ÚIterableÚListÚTupleÚUnion)ÚDataset)Údownload_url_to_fileÚ@209a8b4cd265013e96f4658632a9878103b0c5abf62b50d4ef3ae1be226b29e4Ú@408ccaae803641c6d7b626b6299949320c2dbca96b2220fd3fb17887b023b027)úBhttp://svn.code.sf.net/p/cmusphinx/code/trunk/cmudict/cmudict-0.7búJhttp://svn.code.sf.net/p/cmusphinx/code/trunk/cmudict/cmudict-0.7b.symbols>8   ú.DOTú+PLUSú-DASHú"QUOTEú'QUOTEú(PARENú)PARENú,COMMAú--DASHú.POINTú/SLASHú:COLONú{BRACEú(PARENSú)PARENSú-HYPHENú.PERIODú"UNQUOTEú%PERCENTú.DECIMALú
"END-QUOTEú
"IN-QUOTESú
#HASH-MARKú
&AMPERSANDú
'END-QUOTEú
)END-PARENú
.FULL-STOPú#POUND-SIGNú#SHARP-SIGNú(LEFT-PARENú)END-PARENSú...ELLIPSISú;SEMI-COLONú{LEFT-BRACEú{OPEN-BRACEú"CLOSE-QUOTEú'INNER-QUOTEú(PARENTHESESú)CLOSE-PARENú)RIGHT-PARENú}CLOSE-BRACEú}RIGHT-BRACEú"DOUBLE-QUOTEú"END-OF-QUOTEú'SINGLE-QUOTEú(BEGIN-PARENSú)END-THE-PARENú;SEMI-COLON(1)ú?QUESTION-MARKú(IN-PARENTHESESú)UN-PARENTHESESú'END-INNER-QUOTEú)END-PARENTHESESú(OPEN-PARENTHESESú!EXCLAMATION-POINTú)CLOSE-PARENTHESESÚlinesÚexclude_punctuationsÚreturnc                 ó”  — t        j                  d«      }g }| D ]«  }|r|j                  d«      rŒ|j                  «       j	                  d«      \  }}|t
        v r0|rŒD|j                  d«      rd}n|j                  d«      rd}n|d   }t        j                  |d|«      }|j	                  d«      }|j                  ||f«       Œ­ |S )	Nz
\([0-9]+\)z;;;z  z...z--r   Ú ú )ÚreÚcompileÚ
startswithÚstripÚsplitÚ_PUNCTUATIONSÚsubÚappend)rF   rG   Ú_alt_reÚcmudictÚlineÚwordÚphoness          úp/home/mcse/projects/srt_converter/srt-converter-venv/lib/python3.12/site-packages/torchaudio/datasets/cmudict.pyÚ_parse_dictionaryrZ   J   sÃ   € Ü�j‰j˜Ó'€GØ+-€GØò 'ˆÙ�t—‘ uÔ-Øà—z‘z“|×)Ñ)¨$Ó/‰ˆˆfØ”=Ñ Ù#Øð �‰˜uÔ%Ø‘Ø—‘ Ô&Ø‘à˜A‘w�ô
 �v‰v�g˜r 4Ó(ˆØ—‘˜cÓ"ˆØ�‰˜˜f�~Õ&ð/'ð2 €Nó    c                   ó�   — e Zd ZdZ	 dddddœdeeef   deded	ed
eddfd„Zde	de
eee   f   fd„Zde	fd„Zedee   fd„«       Zy)ÚCMUDictaZ  *CMU Pronouncing Dictionary* :cite:`cmudict` (CMUDict) dataset.

    Args:
        root (str or Path): Path to the directory where the dataset is found or downloaded.
        exclude_punctuations (bool, optional):
            When enabled, exclude the pronounciation of punctuations, such as
            `!EXCLAMATION-POINT` and `#HASH-MARK`.
        download (bool, optional):
            Whether to download the dataset if it is not found at root path. (default: ``False``).
        url (str, optional):
            The URL to download the dictionary from.
            (default: ``"http://svn.code.sf.net/p/cmusphinx/code/trunk/cmudict/cmudict-0.7b"``)
        url_symbols (str, optional):
            The URL to download the list of symbols from.
            (default: ``"http://svn.code.sf.net/p/cmusphinx/code/trunk/cmudict/cmudict-0.7b.symbols"``)
    Fr   r   )ÚdownloadÚurlÚurl_symbolsÚrootrG   r^   r_   r`   rH   Nc                óà  — || _         t        |«      | _        t        j                  j                  | j                  «      st        d|› �«      ‚| j                  t        j                  j                  |«      z  }| j                  t        j                  j                  |«      z  }t        j                  j                  |«      s3|st        d|› �«      ‚t        j                  |d «      }t        |||«       t        j                  j                  |«      s3|st        d|› �«      ‚t        j                  |d «      }t        |||«       t        |d«      5 }	|	j                  «       D �
cg c]  }
|
j                  «       ‘Œ c}
| _        d d d «       t        |dd¬«      5 }	t!        |	j                  «       | j                   ¬«      | _        d d d «       y c c}
w # 1 sw Y   ŒPxY w# 1 sw Y   y xY w)Nz#The root directory does not exist; z`The dictionary file is not found in the following location. Set `download=True` to download it. z\The symbol file is not found in the following location. Set `download=True` to download it. Úrzlatin-1)Úencoding)rG   )rG   r   Ú
_root_pathÚosÚpathÚisdirÚRuntimeErrorÚbasenameÚexistsÚ
_CHECKSUMSÚgetr	   ÚopenÚ	readlinesrO   Ú_symbolsrZ   Ú_dictionary)Úselfra   rG   r^   r_   r`   Ú	dict_fileÚsymbol_fileÚchecksumÚtextrV   s              rY   Ú__init__zCMUDict.__init__{   sª  € ð %9ˆÔ!ä˜t›*ˆŒÜ�w‰w�}‰}˜TŸ_™_Ô-ÜÐ!DÀTÀFÐKÓLÐLà—O‘O¤b§g¡g×&6Ñ&6°sÓ&;Ñ;ˆ	Ø—o‘o¬¯©×(8Ñ(8¸Ó(EÑEˆÜ�w‰w�~‰~˜iÔ(ÙÜ"ð;Ø;D¸+ðGóð ô "—~‘~ c¨4Ó0ˆHÜ   i°Ô:Ü�w‰w�~‰~˜kÔ*ÙÜ"ð;Ø;F¸-ðIóð ô "—~‘~ k°4Ó8ˆHÜ  ¨k¸8ÔDä�+˜sÓ#ð 	H tØ6:·n±nÓ6FÖG¨d˜TŸZ™Z�\ÒGˆDŒM÷	Hô �)˜S¨9Ô5ð 	s¸Ü0°·±Ó1AÐX\×XqÑXqÔrˆDÔ÷	sð 	sùò H÷	Hð 	Hú÷	sð 	sús*   ÅGÅ*GÆGÆ+G$ÇGÇG!Ç$G-Únc                 ó    — | j                   |   S )a  Load the n-th sample from the dataset.

        Args:
            n (int): The index of the sample to be loaded.

        Returns:
            Tuple of a word and its phonemes

            str:
                Word
            List[str]:
                Phonemes
        )rq   )rr   rx   s     rY   Ú__getitem__zCMUDict.__getitem__¤   s   € ð ×Ñ Ñ"Ð"r[   c                 ó,   — t        | j                  «      S )N)Úlenrq   ©rr   s    rY   Ú__len__zCMUDict.__len__´   s   € Ü�4×#Ñ#Ó$Ð$r[   c                 ó6   — | j                   j                  «       S )zLlist[str]: A list of phonemes symbols, such as ``"AA"``, ``"AE"``, ``"AH"``.)rp   Úcopyr}   s    rY   ÚsymbolszCMUDict.symbols·   s   € ð �}‰}×!Ñ!Ó#Ð#r[   )T)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ústrr   Úboolrw   Úintr   r   rz   r~   Úpropertyr�   © r[   rY   r]   r]   i   s¸   „ ñð( &*ð'sð
 ØWØgò'sà�C˜�IÑð'sð #ð'sð
 ð'sð ð'sð ð'sð 
ó'sðR#˜Sð # U¨3°°S±	¨>Ñ%:ó #ð %˜ó %ð ð$˜˜c™ò $ó ñ$r[   r]   )rf   rL   Úpathlibr   Útypingr   r   r   r   Útorch.utils.datar   Útorchaudio._internalr	   rl   rQ   r†   r‡   rZ   r]   rŠ   r[   rY   ú<module>r�      sh   ðÛ 	Û 	Ý ß /Ó /å $Ý 5ð KMð SUñ€
ò9€ðx˜X c™]ð À$ð È4ÐPSÉ9ó ô>Q$ˆgõ Q$r[   