o
    TiO	                     @   s  d Z ddlmZ ddlZddlmZ ddlmZ ddlm	Z	 ddl
mZ edd	fed
dfeddfeddfeddfeddfeddfeddfeddfeddfeddfeddfedd fed!d"fed#d$fed%d&fed'd(fed)d*fed+d,fed-d.fed/d0fed1d2fed3d4fed5d6fed7d8fed9d:fed;d<fed=d>ffZeed?d@ZG dAdB dBeZe ZeejejdC eejejdC dS )DuQ   BOPOMOFO 相关的几个拼音风格实现:

Style.BOPOMOFO
Style.BOPOMOFO_FIRST
    )unicode_literalsN)Style)register)RE_TONE3)replace_symbol_to_numberz^m(\d)$zmu\1z^n(\d)$zN\1z^r5$er5iuiouuiueiongungz^yi?iz^wu?uvz	^([jqx])uz\1vz([iuv])nz\1enz^zhi?Zz^chi?Cz^shi?Sz
^([zcsr])iz\1aiAeiIaoOouUangKengGanMenNerRehEz([iv])ez\1Ez	([^0-4])$z\g<1>0z1$ u+   bpmfdtnlgkhjqxZCSrzcsiuvaoeEAIOUMNKGR2340êuz   ㄅㄆㄇㄈㄉㄊㄋㄌㄍㄎㄏㄐㄑㄒㄓㄔㄕㄖㄗㄘㄙㄧㄨㄩㄚㄛㄜㄝㄞㄟㄠㄡㄢㄣㄤㄥㄦˊˇˋ˙ㄝc                   @   s$   e Zd Zdd Zdd Zdd ZdS )BopomofoConverterc                 K   s<   |  |}tD ]
\}}|||}qddd |D }|S )Nr(   c                 s   s    | ]	}t ||V  qd S )N)BOPOMOFO_TABLEget).0x r.   K/home/ubuntu/.local/lib/python3.10/site-packages/pypinyin/style/bopomofo.py	<genexpr>:   s    z0BopomofoConverter.to_bopomofo.<locals>.<genexpr>)_pre_convertBOPOMOFO_REPLACEsubjoin)selfpinyinkwargsfind_rereplacer.   r.   r/   to_bopomofo5   s
   
zBopomofoConverter.to_bopomofoc                 K   s   | j |fi |}|d S )Nr   )r:   )r5   r6   r7   r.   r.   r/   to_bopomofo_first=   s   z#BopomofoConverter.to_bopomofo_firstc                 C   s   t |}td|S )Nz\1\3\2)r   r   r3   )r5   r6   r.   r.   r/   r1   A   s   zBopomofoConverter._pre_convertN)__name__
__module____qualname__r:   r;   r1   r.   r.   r.   r/   r)   4   s    r)   )func)__doc__
__future__r   repypinyin.constantsr   pypinyin.styler   pypinyin.style._constantsr   pypinyin.style._utilsr   compiler2   dictzipr*   objectr)   	converterBOPOMOFOr:   BOPOMOFO_FIRSTr;   r.   r.   r.   r/   <module>   sX   