+
    TV-j7  ã                  ó~   € ^ RI Ht ^ RIHtHt ^ RIHt ]! RR7       ! R R4      4       tR R	 ltR
 R lt	R R lt
R# )é    )Úannotations)ÚasdictÚ	dataclass)ÚIterableT)Úfrozenc                  óv   € ] tR t^t$ R]R&   R]R&   R]R&   R]R&   R]R&   R]R&   ]R	 R
 l4       tR R ltRtR# )Ú	WERResultÚintÚsubstitutionsÚ	deletionsÚ
insertionsÚreference_tokensÚhypothesis_tokensÚfloatÚwerc               ó   € V ^8„  d   QhRR/# )é   Úreturnr
   © )Úformats   "Úg/Volumes/fast/ai/experiments/ui-tars-smoke/.venv/lib/python3.14/site-packages/mlx_audio/stt/eval/wer.pyÚ__annotate__ÚWERResult.__annotate__   s   € ÷ Eñ E�sñ Eó    c                	ó^   € V P                   V P                  ,           V P                  ,           # ©N)r   r   r   )Úselfs   &r   ÚeditsÚWERResult.edits   s    € à×!Ñ! D§N¡NÕ2°T·_±_ÕDÐDr   c               ó   € V ^8„  d   QhRR/# )r   r   Údictr   )r   s   "r   r   r      s   € ÷ ñ ˜ñ r   c                	ó:   € \        V 4      pV P                  VR &   V# )r   )r   r   )r   Údatas   & r   Úto_dictÚWERResult.to_dict   s   € Ü�d‹|ˆØŸ
™
ˆˆW‰Øˆr   r   N)	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__annotations__Úpropertyr   r$   Ú__static_attributes__r   r   r   r	   r	      sA   ‡ àÓØƒNØƒOØÓØÓØ	ƒJàôEó ðE÷ñ r   r	   c               ó    € V ^8„  d   QhRRRR/# )r   Ú	candidateztuple[int, int, int, int]Úbestr   )r   s   "r   r   r      s   € ÷ ñ Ð0ð Ð8Qñ r   c                óŒ   € V ^ ,          V ^,          V ^,          V ^,          3V^ ,          V^,          V^,          V^,          38  # )zKTie-break edit paths deterministically: fewer edits, then fewer insertions.r   )r.   r/   s   &&r   Ú_preferr1      sJ   € à�a�L˜) A�,¨	°!­°iÀµlÐCØˆQ�ØˆQ�ØˆQ�ØˆQ�ð	Gñ ð r   c               ó$   € V ^8„  d   QhRRRRRR/# )r   Ú	referencezstr | Iterable[str]Ú
hypothesisr   r	   r   )r   s   "r   r   r   $   s$   € ÷ ;ñ ;Ø"ð;Ø0Cð;àñ;r   c           	     ó²  € \        V \        4      '       d   V P                  4       M
\        V 4      p\        V\        4      '       d   VP                  4       M
\        V4      p\	        V4      p\	        V4      p\        V^,           4       Uu. uF%  p\        V^,           4       Uu. uF  pRNK  	  upNK'  	  pp\        ^V^,           4       F8  pWx^,
          ,          ^ ,          w  ršr¼V	^,           W«^,           V3Wx,          ^ &   K:  	  \        ^V^,           4       F:  pV^ ,          V^,
          ,          w  ršr¼V	^,           W«V^,           3V^ ,          V&   K<  	  \        ^V^,           4       EF  p\        ^V^,           4       EF   pW(^,
          ,          W=^,
          ,          8X  d   Wx^,
          ,          V^,
          ,          pM3Wx^,
          ,          V^,
          ,          w  ršr¼V	^,           V
^,           W¼3pWx^,
          ,          V,          w  ršr¼V	^,           W«^,           V3p\        Wþ4      '       d   TpWx,          V^,
          ,          w  ršr¼V	^,           W«V^,           3p\        VV4      '       d   TpWçV,          V&   EK  	  EK  	  Wt,          V,          w  ppppV^ 8X  d   V^ 8X  d   RMRpM	VV,          p\        VVVVVVR7      # u upi u upi )z±Compute WER and edit operation counts.

Args:
    reference: Reference text or pre-tokenized reference words.
    hypothesis: Hypothesis text or pre-tokenized hypothesis words.
ç        g      ð?)r   r   r   r   r   r   )r   r   r   r   )Ú
isinstanceÚstrÚsplitÚlistÚlenÚranger1   r	   )r3   r4   Ú
ref_tokensÚ
hyp_tokensÚnÚmÚ_ÚdpÚiÚcostÚsubsÚdelsÚinsÚjr/   ÚdeletionÚ	insertionr   r   r   r   r   s   &&                    r   Úcompute_werrK   $   sw  € ô '1°¼C×&@Ò&@�—‘Ô"ÄdÈ9Ão€JÜ'1°*¼c×'BÒ'B�×!Ñ!Ô#ÌÈZÓHX€JäˆJ‹€AÜˆJ‹€Aä6;¸AÀ½E´ló1Ù6B°œu Q¨¥Uœ|Ó,™|˜!‹™|Ô,±lð ð 1ô �1�a˜!•eŽ_ˆØ " q¥5¥	¨!¥Ñˆ�DØ˜1•H˜d¨1¥H¨cÐ2ˆ�ˆa‹ñ ô �1�a˜!•eŽ_ˆØ " 1¥ a¨!¥e¥Ñˆ�DØ˜1•H˜d¨#°­'Ð2ˆˆ1�ˆa‹ñ ô �1�a˜!•e�_ˆÜ�q˜!˜a�%—ˆAØ˜a�%Õ  J°1­uÕ$5Ô5Ø˜a�%•y  Q¥Õ'‘à(*¨q­5­	°!°aµ%Õ(8Ñ%�˜DØ˜q� $¨¥(¨DÐ6�à$&¨1¥u¥I¨a¥LÑ!ˆD˜Ø˜q� $¨q­°#Ð6ˆHÜ�x×&Ò&Ø�à$&¥E¨!¨a­%¥LÑ!ˆD˜Ø � 4¨s°Q­wÐ7ˆIÜ�y $×'Ò'Ø �àˆq�E�!ŒHô# !ñ ð( 35µ%¸µ(Ñ/€Eˆ=˜) ZØˆA„vØ˜a”Z‰c S‰à�a�iˆäØ#ØØØØØôð ùòK 	-ùò1s   ÂKÂ&K
Â1KËKc               ó    € V ^8„  d   QhRRRR/# )r   ÚresultszIterable[WERResult]r   r!   r   )r   s   "r   r   r   b   s   € ÷ ñ Ð.ð °4ñ r   c                óò  € \        V 4      p \        R  V  4       4      p\        R V  4       4      p\        R V  4       4      p\        R V  4       4      pW#,           V,           pV'       d	   WQ,          MRpV '       d#   \        R V  4       4      \        V 4      ,          MRpRTRTRV'       d	   W!,          MRR	V'       d	   W1,          MRR
V'       d	   WA,          MRRVR\        R V  4       4      RVRVRVRV/# )c              3  ó8   "  € T F  qP                   x € K  	  R # 5ir   )r   ©Ú.0Úresults   & r   Ú	<genexpr>Ú aggregate_wer.<locals>.<genexpr>d   s   é € ÐB¹'°×+Ö+»'ùó   ‚c              3  ó8   "  € T F  qP                   x € K  	  R # 5ir   )r   rP   s   & r   rS   rT   e   s   é € Ð@¹¨f×)Ö)»ùrU   c              3  ó8   "  € T F  qP                   x € K  	  R # 5ir   )r   rP   s   & r   rS   rT   f   s   é € Ð<±G¨&×%Ö%³GùrU   c              3  ó8   "  € T F  qP                   x € K  	  R # 5ir   )r   rP   s   & r   rS   rT   g   s   é € Ð<±G¨&×%Ö%³GùrU   r6   c              3  ó8   "  € T F  qP                   x € K  	  R # 5ir   )r   rP   s   & r   rS   rT   j   s   é € Ð5©W 6—J–J«WùrU   Ú	wer_microÚ	wer_macroÚsubstitution_rateÚdeletion_rateÚinsertion_rateÚtotal_reference_tokensÚtotal_hypothesis_tokensc              3  ó8   "  € T F  qP                   x € K  	  R # 5ir   )r   rP   s   & r   rS   rT   s   s   é € Ð&VÉgÀF×'?Ö'?ËgùrU   Útotal_substitutionsÚtotal_deletionsÚtotal_insertionsÚtotal_edits)r:   Úsumr;   )rM   Ú	total_refÚ
total_subsÚ
total_delsÚ	total_insre   rZ   r[   s   &       r   Úaggregate_werrk   b   så   € Ü�7‹m€GÜÑB¹'ÓBÓB€IÜÑ@¹Ó@Ó@€JÜÑ<±GÓ<Ó<€JÜÑ<±GÓ<Ó<€IØÕ)¨IÕ5€Kß+4�Ö'¸#€IßHO”Ñ5©WÓ5Ó5¼¸G»ÖDÐUX€Ið 	�YØ�YØ·y˜ZÖ3ÀcØ·9˜Ö/À#Ø·9˜)Ö/À#Ø  )Ø!¤3Ñ&VÉgÓ&VÓ#VØ˜zØ˜:Ø˜IØ�{ðð r   N)Ú
__future__r   Údataclassesr   r   Útypingr   r	   r1   rK   rk   r   r   r   Ú<module>ro      s<   ðÝ "ç )Ý ñ �$Ô÷ð ó ðõ$õ;÷|r   