ó qP–[c@s§dZddlZddlmZddlmZd„eeƒDƒZd„eeƒDƒZej dƒZ d„Z d „Z d „Z d „Zd „Zd „ZdS(s+ from https://github.com/keithito/tacotron iÿÿÿÿN(tcleaners(tsymbolscCsi|]\}}||“qS(((t.0tits((s=/home/alex/PyTorch_Projects/NVIDIA-tacotron2/text/__init__.pys s cCsi|]\}}||“qS(((RRR((s=/home/alex/PyTorch_Projects/NVIDIA-tacotron2/text/__init__.pys s s(.*?)\{(.+?)\}(.*)cCsªg}xŒt|ƒr”tj|ƒ}|sG|tt||ƒƒ7}Pn|tt|jdƒ|ƒƒ7}|t|jdƒƒ7}|jdƒ}q W|jtdƒ|S(sÆConverts a string of text to a sequence of IDs corresponding to the symbols in the text. The text can optionally have ARPAbet sequences enclosed in curly braces embedded in it. For example, "Turn left on {HH AW1 S S T AH0 N} Street." Args: text: string to convert to a sequence cleaner_names: names of the cleaner functions to run the text through Returns: List of integers corresponding to the symbols in the text iiit~( tlent _curly_retmatcht_symbols_to_sequencet _clean_texttgroupt_arpabet_to_sequencetappendt _symbol_to_id(ttextt cleaner_namestsequencetm((s=/home/alex/PyTorch_Projects/NVIDIA-tacotron2/text/__init__.pyttext_to_sequences "cCs}d}xd|D]\}|tkr t|}t|ƒdkr\|ddkr\d|d}n||7}q q W|jddƒS(s+Converts a sequence of IDs back to a stringtiit@s{%s}s}{t (t _id_to_symbolRtreplace(Rtresultt symbol_idR((s=/home/alex/PyTorch_Projects/NVIDIA-tacotron2/text/__init__.pytsequence_to_text-s   "cCsIxB|D]:}tt|ƒ}|s5td|ƒ‚n||ƒ}qW|S(NsUnknown cleaner: %s(tgetattrRt Exception(RRtnametcleaner((s=/home/alex/PyTorch_Projects/NVIDIA-tacotron2/text/__init__.pyR :s  cCs'g|D]}t|ƒrt|^qS(N(t_should_keep_symbolR(RR((s=/home/alex/PyTorch_Projects/NVIDIA-tacotron2/text/__init__.pyR CscCs'tg|jƒD]}d|^qƒS(NR(R tsplit(RR((s=/home/alex/PyTorch_Projects/NVIDIA-tacotron2/text/__init__.pyR GscCs"|tko!|dk o!|dk S(Nt_R(R(R((s=/home/alex/PyTorch_Projects/NVIDIA-tacotron2/text/__init__.pyR Ks(t__doc__treRRt text.symbolsRt enumerateRRtcompileRRRR R R R (((s=/home/alex/PyTorch_Projects/NVIDIA-tacotron2/text/__init__.pyts