§
    
@Äj   ã                   ó¬   — 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dS )é    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|                     d¦  «        rŒ|                     ¦   «                              d¦  «        \  }}|t
          v r;|rŒP|                     d¦  «        rd}n |                     d¦  «        rd}n|d         }t          j        |d|¦  «        }|                     d¦  «        }|                     ||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          úLC:\Projects\Historical\venv\Lib\site-packages\torchaudio/datasets/cmudict.pyÚ_parse_dictionaryrZ   J   sý   € ÝŒj˜Ñ'Ô'€GØ+-€GØð 'ð 'ˆØð 	�t—’ uÑ-Ô-ð 	Øà—z’z‘|”|×)Ò)¨$Ñ/Ô/‰ˆˆfØ•=Ð Ð Ø#ð Øð �Š˜uÑ%Ô%ð Ø��Ø—’ Ñ&Ô&ð Ø��à˜A”w�õ
 Œv�g˜r 4Ñ(Ô(ˆØ—’˜cÑ"Ô"ˆØ�Š˜˜f�~Ñ&Ô&Ð&Ð&à€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dS )Ú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"``)
    TFr   r   )ÚdownloadÚurlÚurl_symbolsÚrootrG   r^   r_   r`   rH   Nc                ó  — || _         t          |¦  «        | _        t          j                             | j        ¦  «        st          d|› �¦  «        ‚| j        t          j                             |¦  «        z  }| j        t          j                             |¦  «        z  }t          j                             |¦  «        s@|st          d|› �¦  «        ‚t           
                    |d ¦  «        }t          |||¦  «         t          j                             |¦  «        s@|st          d|› �¦  «        ‚t           
                    |d ¦  «        }t          |||¦  «         t          |d¦  «        5 }	d„ |	                     ¦   «         D ¦   «         | _        d d d ¦  «         n# 1 swxY w Y   t          |dd¬¦  «        5 }	t          |	                     ¦   «         | j         ¬¦  «        | _        d d d ¦  «         d S # 1 swxY w Y   d S )	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. Úrc                 ó6   — g | ]}|                      ¦   «         ‘ŒS © )rO   )Ú.0rV   s     rY   ú
<listcomp>z$CMUDict.__init__.<locals>.<listcomp>Ÿ   s    € ÐGÐGÐG¨d˜TŸZšZ™\œ\ÐGÐGÐGr[   zlatin-1)Úencoding)rG   )rG   r   Ú
_root_pathÚosÚpathÚisdirÚRuntimeErrorÚbasenameÚexistsÚ
_CHECKSUMSÚgetr	   ÚopenÚ	readlinesÚ_symbolsrZ   Ú_dictionary)
Úselfra   rG   r^   r_   r`   Ú	dict_fileÚsymbol_fileÚchecksumÚtexts
             rY   Ú__init__zCMUDict.__init__{   s™  € ð %9ˆÔ!å˜t™*œ*ˆŒÝŒw�}Š}˜Tœ_Ñ-Ô-ð 	MÝÐKÀTÐKÐKÑLÔLÐLà”O¥b¤g×&6Ò&6°sÑ&;Ô&;Ñ;ˆ	Ø”o­¬×(8Ò(8¸Ñ(EÔ(EÑEˆÝŒw�~Š~˜iÑ(Ô(ð 	;Øð Ý"ðGØ;DðGð Gñô ð õ "—~’~ c¨4Ñ0Ô0ˆHÝ   i°Ñ:Ô:Ð:ÝŒw�~Š~˜kÑ*Ô*ð 	EØð Ý"ðIØ;FðIð Iñô ð õ "—~’~ k°4Ñ8Ô8ˆHÝ  ¨k¸8ÑDÔDÐDå�+˜sÑ#Ô#ð 	H tØGÐG°d·n²nÑ6FÔ6FÐGÑGÔGˆDŒMð	Hð 	Hð 	Hñ 	Hô 	Hð 	Hð 	Hð 	Hð 	Hð 	Hð 	Høøøð 	Hð 	Hð 	Hð 	Hõ �)˜S¨9Ð5Ñ5Ô5ð 	s¸Ý0°·²Ñ1AÔ1AÐX\ÔXqÐrÑrÔrˆDÔð	sð 	sð 	sñ 	sô 	sð 	sð 	sð 	sð 	sð 	sð 	sð 	søøøð 	sð 	sð 	sð 	sð 	sð 	ss$   Å.$FÆF"Æ%F"Æ;.G6Ç6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
        )ru   )rv   r|   s     rY   Ú__getitem__zCMUDict.__getitem__¤   s   € ð Ô Ô"Ð"r[   c                 ó*   — t          | j        ¦  «        S )N)Úlenru   ©rv   s    rY   Ú__len__zCMUDict.__len__´   s   € Ý�4Ô#Ñ$Ô$Ð$r[   c                 ó4   — | j                              ¦   «         S )zLlist[str]: A list of phonemes symbols, such as ``"AA"``, ``"AE"``, ``"AH"``.)rt   Úcopyr�   s    rY   ÚsymbolszCMUDict.symbols·   s   € ð Œ}×!Ò!Ñ#Ô#Ð#r[   )T)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ústrr   Úboolr{   Úintr   r   r~   r‚   Úpropertyr…   re   r[   rY   r]   r]   i   s  € € € € € ðð ð( &*ð'sð
 ØWØgð'sð 'sð 'sà�C˜�IÔð'sð #ð'sð
 ð'sð ð'sð ð'sð 
ð'sð 'sð 'sð 'sðR#˜Sð # U¨3°°S´	¨>Ô%:ð #ð #ð #ð #ð %˜ð %ð %ð %ð %ð ð$˜˜cœð $ð $ð $ñ „Xð$ð $ð $r[   r]   )rj   rL   Úpathlibr   Útypingr   r   r   r   Útorch.utils.datar   Útorchaudio._internalr	   rp   rQ   rŠ   r‹   rZ   r]   re   r[   rY   ú<module>r’      s  ðØ 	€	€	€	Ø 	€	€	€	Ø Ð Ð Ð Ð Ð Ø /Ð /Ð /Ð /Ð /Ð /Ð /Ð /Ð /Ð /Ð /Ð /à $Ð $Ð $Ð $Ð $Ð $Ø 5Ð 5Ð 5Ð 5Ð 5Ð 5ð KMð SUðð €
ð9ð 9ð 9€ðx˜X cœ]ð À$ð È4ÐPSÌ9ð ð ð ð ð>Q$ð Q$ð Q$ð Q$ð Q$ˆgñ Q$ô Q$ð Q$ð Q$ð Q$r[   