§
    ÷óÉj#!  ã                   óP   — d dl Z d dlmZmZmZ d dlmZmZmZ  G d„ d¦  «        Z	dS )é    N)ÚOptionalÚTupleÚUnion)ÚTimelineÚSegmentÚ
Annotationc                   óä   — e Zd ZdZ	 	 ddededededef
d	„Zded
edefd„Z	dededefd„Z
	 	 	 	 	 dded
edee         dededededeeeef         eeeef         eeeeef         f         fd„ZdS )ÚUEMSupportMixinu:   Provides 'uemify' method with optional (Ã  la NIST) collarç        FÚuemÚ	referenceÚcollarÚskip_overlapÚreturnc           	      ó6  — |dk    r|s|S g g }}|dk    rƒ|                      ¦   «         D ]n}|j        }|                     t          |d|z  z
  |d|z  z   ¦  «        ¦  «         |j        }|                     t          |d|z  z
  |d|z  z   ¦  «        ¦  «         Œo|rF|                     |¦  «        D ]0\  \  }	}
\  }}|	|k    r|
|k    rŒ|                     |	|z  ¦  «         Œ1||z   }t          |¬¦  «                             ¦   «                              |¬¦  «        S )a…  Extrude reference boundary collars from uem

        reference     |----|     |--------------|       |-------------|
        uem       |---------------------|    |-------------------------------|
        extruded  |--| |--| |---| |-----|    |-| |-----| |-----------| |-----|

        Parameters
        ----------
        uem : Timeline
            Evaluation map.
        reference : Annotation
            Reference annotation.
        collar : float, optional
            When provided, set the duration of collars centered around
            reference segment boundaries that are extruded from both reference
            and hypothesis. Defaults to 0. (i.e. no collar).
        skip_overlap : bool, optional
            Set to True to not evaluate overlap regions.
            Defaults to False (i.e. keep overlap regions).

        Returns
        -------
        extruded_uem : Timeline
        r   g      à?)Úsegments)Úsupport)	ÚitersegmentsÚstartÚappendr   ÚendÚco_iterr   r   Úgaps)Úselfr   r   r   r   ÚcollarsÚoverlap_regionsÚsegmentÚtÚsegment1Útrack1Úsegment2Útrack2r   s                 úy/home/lighthouse/badge-speaker-benchmark/.benchmark-venv-community/lib/python3.11/site-packages/pyannote/metrics/utils.pyÚextrudezUEMSupportMixin.extrude&   sT  € ð< �RŠ<ˆ< ˆ<ØˆJà#% r�ˆð �BŠ;ˆ;à$×1Ò1Ñ3Ô3ð Jð J�à”M�Ø—’�w q¨2°©;¡¸¸BÀ¹K¹ÑHÔHÑIÔIÐIð ”K�Ø—’�w q¨2°©;¡¸¸BÀ¹K¹ÑHÔHÑIÔIÐIÐIð ð 	<à:C×:KÒ:KÈIÑ:VÔ:Vð <ð <Ñ6Ñ"�˜6Ñ$6 X¨vØ˜xÒ'Ð'¨F°fÒ,<Ð,<Øà×&Ò& x°(Ñ':Ñ;Ô;Ð;Ð;à˜_Ñ,ˆå Ð*Ñ*Ô*×2Ò2Ñ4Ô4×9Ò9À#Ð9ÑFÔFÐFó    Ú
hypothesisc                 ó¨   — |                      d¬¦  «        }|                     |                      d¬¦  «        ¦  «         |                     ¦   «         S )aÊ  Return timeline common to both reference and hypothesis

        reference   |--------|    |------------|     |---------|         |----|
        hypothesis     |--------------| |------|   |----------------|
        timeline    |--|-----|----|---|-|------|   |-|---------|----|    |----|

        Parameters
        ----------
        reference : Annotation
        hypothesis : Annotation

        Returns
        -------
        timeline : Timeline
        T©ÚcopyF)Úget_timelineÚupdateÚsegmentation)r   r   r&   Útimelines       r#   Úcommon_timelinezUEMSupportMixin.common_timelineb   sO   € ð" ×)Ò)¨tÐ)Ñ4Ô4ˆØ�Š˜
×/Ò/°UÐ/Ñ;Ô;Ñ<Ô<Ð<Ø×$Ò$Ñ&Ô&Ð&r%   Ú
annotationr-   c                 ó  — |                      ¦   «         }|                     d¬¦  «        }|                     |¦  «        D ]C\  }}|                     |¦  «        D ](}|                     ||¬¦  «        }|||f         |||f<   Œ)ŒD|S )a™  Project annotation onto timeline segments

        reference     |__A__|     |__B__|
                        |____C____|

        timeline    |---|---|---|   |---|

        projection  |_A_|_A_|_C_|   |_B_|
                        |_C_|

        Parameters
        ----------
        annotation : Annotation
        timeline : Timeline

        Returns
        -------
        projection : Annotation
        Fr(   )Ú	candidate)Úemptyr*   r   Ú
get_tracksÚ	new_track)	r   r/   r-   Ú
projectionÚ	timeline_Úsegment_r   Útrack_Útracks	            r#   ÚprojectzUEMSupportMixin.projectw   s¯   € ð(  ×%Ò%Ñ'Ô'ˆ
Ø×+Ò+°Ð+Ñ7Ô7ˆ	Ø!*×!2Ò!2°8Ñ!<Ô!<ð 	Jð 	JÑˆH�gØ$×/Ò/°Ñ9Ô9ð Jð J�Ø"×,Ò,¨WÀÐ,ÑGÔG�Ø-7¸À&Ð8HÔ-I�
˜7 E˜>Ñ*Ð*ðJð Ðr%   NÚreturns_uemÚreturns_timelinec                 óH  — |€€|                      ¦   «                              ¦   «         }|                      ¦   «                              ¦   «         }	||	z  }
t          |
r|
gng |j        ¬¦  «        }t	          j        d¦  «         |                      ||||¬¦  «        }|                     |d¬¦  «        }|                     |d¬¦  «        }|rB|                      ||¦  «        }|  	                    ||¦  «        }|  	                    ||¦  «        }||f}|r||fz  }|r||fz  }|S )a   Crop 'reference' and 'hypothesis' to 'uem' support

        Parameters
        ----------
        reference, hypothesis : Annotation
            Reference and hypothesis annotations.
        uem : Timeline, optional
            Evaluation map.
        collar : float, optional
            When provided, set the duration of collars centered around
            reference segment boundaries that are extruded from both reference
            and hypothesis. Defaults to 0. (i.e. no collar).
        skip_overlap : bool, optional
            Set to True to not evaluate overlap regions.
            Defaults to False (i.e. keep overlap regions).
        returns_uem : bool, optional
            Set to True to return extruded uem as well.
            Defaults to False (i.e. only return reference and hypothesis)
        returns_timeline : bool, optional
            Set to True to oversegment reference and hypothesis so that they
            share the same internal timeline.

        Returns
        -------
        reference, hypothesis : Annotation
            Extruded reference and hypothesis annotations
        uem : Timeline
            Extruded uem (returned only when 'returns_uem' is True)
        timeline : Timeline:
            Common timeline (returned only when 'returns_timeline' is True)
        N)r   ÚurizL'uem' was approximated by the union of 'reference' and 'hypothesis' extents.)r   r   Úintersection)Úmode)
r*   Úextentr   r>   ÚwarningsÚwarnr$   Úcropr.   r:   )r   r   r&   r   r   r   r;   r<   Úr_extentÚh_extentrA   r-   Úresults                r#   ÚuemifyzUEMSupportMixin.uemify“   sX  € ð^ ˆ;Ø ×-Ò-Ñ/Ô/×6Ò6Ñ8Ô8ˆHØ!×.Ò.Ñ0Ô0×7Ò7Ñ9Ô9ˆHØ Ñ(ˆFÝ°Ð$> V H H¸BØ(œ}ð.ñ .ô .ˆCåŒMð,ñ-ô -ð -ð
 �lŠl˜3 	°&Ø(4ð ñ 6ô 6ˆð —N’N 3¨^�NÑ<Ô<ˆ	Ø—_’_ S¨~�_Ñ>Ô>ˆ
ð ð 	<Ø×+Ò+¨I°zÑBÔBˆHØŸš Y°Ñ9Ô9ˆIØŸš j°(Ñ;Ô;ˆJà˜ZÐ(ˆØð 	Ø�s�fÑˆFàð 	"Ø�x�kÑ!ˆFàˆr%   )r   F)Nr   FFF)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   ÚfloatÚboolr$   r.   r:   r   r   r   rH   © r%   r#   r
   r
   #   s‰  € € € € € ØDÐDð
 !$Ø%*ð	:Gð :GØð:Gà%ð:Gð ð:Gð #ð	:Gð 08ð	:Gð :Gð :Gð :Gðx'¨ð 'Àð 'Øð'ð 'ð 'ð 'ð* *ð ¸ð ÀZð ð ð ð ð> *.Ø!Ø$)Ø#(Ø(-ðNð NØ$ðNà%ðNð ˜XÔ&ðNð ð	Nð
 "ðNð !ðNð "&ðNð Ø�j *Ð,Ô-Ø�j *¨hÐ6Ô7Ø�j *¨h¸Ð@ÔAðCôðNð Nð Nð Nð Nð Nr%   r
   )
rB   Útypingr   r   r   Úpyannote.corer   r   r   r
   rO   r%   r#   ú<module>rR      sˆ   ðð: €€€Ø )Ð )Ð )Ð )Ð )Ð )Ð )Ð )Ð )Ð )à 7Ð 7Ð 7Ð 7Ð 7Ð 7Ð 7Ð 7Ð 7Ð 7ð~ð ~ð ~ð ~ð ~ñ ~ô ~ð ~ð ~ð ~r%   