Ë
      çi@,  ã                   ó&   — d dl mZ  G d„ de«      Zy)é   )ÚSpeakerDiarizationProtocolc                   ój   — e Zd ZdZd„ Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
d	„ Zd
„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zy)ÚSpeakerSpottingProtocola‹  Speaker spotting protocol

    Parameters
    ----------
    preprocessors : dict or (key, preprocessor) iterable
        When provided, each protocol item (dictionary) are preprocessed, such
        that item[key] = preprocessor(item). In case 'preprocessor' is not
        callable, it should be a string containing placeholder for item keys
        (e.g. {'audio': '/path/to/{uri}.wav'})
    c                 ó   — t        d«      ‚)Nz=Custom speaker spotting protocol should implement "trn_iter".©ÚNotImplementedError©Úselfs    ú€/Volumes/fast/ai/experiments/voice-extract-mac/.venv/lib/python3.12/site-packages/pyannote/database/protocol/speaker_spotting.pyÚtrn_iterz SpeakerSpottingProtocol.trn_iter-   ó   € Ü!ØKó
ð 	
ó    c                  ó   — y ©N© r	   s    r   Útrn_enrol_iterz&SpeakerSpottingProtocol.trn_enrol_iter2   ó   € Ør   c                  ó   — y r   r   r	   s    r   Útrn_try_iterz$SpeakerSpottingProtocol.trn_try_iter5   r   r   c                 ó   — t        d«      ‚)Nz=Custom speaker spotting protocol should implement "dev_iter".r   r	   s    r   Údev_iterz SpeakerSpottingProtocol.dev_iter8   r   r   c                 ó   — t        d«      ‚)NzCCustom speaker spotting protocol should implement "dev_enrol_iter".r   r	   s    r   Údev_enrol_iterz&SpeakerSpottingProtocol.dev_enrol_iter=   ó   € Ü!ØQó
ð 	
r   c                 ó   — t        d«      ‚)NzACustom speaker spotting protocol should implement "dev_try_iter".r   r	   s    r   Údev_try_iterz$SpeakerSpottingProtocol.dev_try_iterB   ó   € Ü!ØOó
ð 	
r   c                 ó   — t        d«      ‚)Nz=Custom speaker spotting protocol should implement "tst_iter".r   r	   s    r   Útst_iterz SpeakerSpottingProtocol.tst_iterG   r   r   c                 ó   — t        d«      ‚)NzCCustom speaker spotting protocol should implement "tst_enrol_iter".r   r	   s    r   Útst_enrol_iterz&SpeakerSpottingProtocol.tst_enrol_iterL   r   r   c                 ó   — t        d«      ‚)NzACustom speaker spotting protocol should implement "tst_try_iter".r   r	   s    r   Útst_try_iterz$SpeakerSpottingProtocol.tst_try_iterQ   r   r   c              #   ó`   K  — | j                  «       }|D ]  }| j                  |«      –— Œ y­w)a;  Iterate over the enrolments of the train set

        Yields dictionaries with the followings keys:

        * uri: str
          unique audio file identifier
        * database: str
          unique database identifier
        * model_id: str
          unique model identifier (the same speaker might have different models)
        * enrol_with: pyannote.core.Timeline
          parts of the audio file to use for enrolment

        as well as keys coming from the provided preprocessors (e.g. 'audio')

        Usage
        -----
        >>> models = {}
        >>> for enrolment in protocol.train_enrolment():
        ...     # obtain path to audio file
        ...     audio = enrolment['audio']
        ...     # obtain parts of the audio file to use for enrolment
        ...     enrol_with = enrolment['enrol_with']
        ...     # this is where enrolment actually happens
        ...     model = do_something(audio, enrol_with)
        ...     # store models for later use
        ...     model_id = enrolment['model_id']
        ...     models[model_id] = model

        N)r   Ú
preprocess©r
   Ú	generatorÚcurrent_enrolments      r   Útrain_enrolmentz'SpeakerSpottingProtocol.train_enrolmentV   ó2   è ø€ ð@ ×'Ñ'Ó)ˆ	ã!*ÐØ—/‘/Ð"3Ó4Ó4ñ "+ùó   ‚,.c              #   ó`   K  — | j                  «       }|D ]  }| j                  |«      –— Œ y­w)aQ  Iterate over the trials of the train set

        Yields dictionaries with the followings keys:

        * uri: str
          unique audio file identifier
        * database: str
          unique database identifier
        * try_with: pyannote.core.Segment, optional
          parts of the audio file where to look for the target speaker.
          default is to use the whole audio file
        * model_id: str
          unique identifier of the target
        * reference: pyannote.core.Timeline
          parts of the audio file where the target actually speaks.
          it might be empty in case of impostor trials.
          in case of genuine trials, it should be contained in `try_with`

        as well as keys coming from the provided preprocessors (e.g. 'audio')

        Usage
        -----
        >>> for trial in protocol.train_trial():
        ...     # obtain path to audio file
        ...     audio = trial['audio']
        ...     # obtain parts of the audio file to use for trial
        ...     try_with = trial['try_with']
        ...     # this is where the trial actually happens
        ...     model_id = trial['model_id']
        ...     score = do_something(audio, try_with, model_id)
        ...     # optionally perform evaluation
        ...     reference = trial['reference']
        ...     metric(reference, score)

        N)r   r%   ©r
   r'   Úcurrent_trials      r   Útrain_trialz#SpeakerSpottingProtocol.train_trial{   ó0   è ø€ ðJ ×%Ñ%Ó'ˆ	ã&ˆMØ—/‘/ -Ó0Ó0ñ 'ùr+   c              #   ó`   K  — | j                  «       }|D ]  }| j                  |«      –— Œ y­w)aG  Iterate over the enrolments of the development set

        Yields dictionaries with the followings keys:

        * uri: str
          unique audio file identifier
        * database: str
          unique database identifier
        * model_id: str
          unique model identifier (the same speaker might have different models)
        * enrol_with: pyannote.core.Timeline
          parts of the audio file to use for enrolment

        as well as keys coming from the provided preprocessors (e.g. 'audio')

        Usage
        -----
        >>> models = {}
        >>> for enrolment in protocol.development_enrolment():
        ...     # obtain path to audio file
        ...     audio = enrolment['audio']
        ...     # obtain parts of the audio file to use for enrolment
        ...     enrol_with = enrolment['enrol_with']
        ...     # this is where enrolment actually happens
        ...     model = do_something(audio, enrol_with)
        ...     # store models for later use
        ...     model_id = enrolment['model_id']
        ...     models[model_id] = model

        N)r   r%   r&   s      r   Údevelopment_enrolmentz-SpeakerSpottingProtocol.development_enrolment¥   r*   r+   c              #   ó`   K  — | j                  «       }|D ]  }| j                  |«      –— Œ y­w)a]  Iterate over the trials of the development set

        Yields dictionaries with the followings keys:

        * uri: str
          unique audio file identifier
        * database: str
          unique database identifier
        * try_with: pyannote.core.Segment, optional
          parts of the audio file where to look for the target speaker.
          default is to use the whole audio file
        * model_id: str
          unique identifier of the target
        * reference: pyannote.core.Timeline
          parts of the audio file where the target actually speaks.
          it might be empty in case of impostor trials.
          in case of genuine trials, it should be contained in `try_with`

        as well as keys coming from the provided preprocessors (e.g. 'audio')

        Usage
        -----
        >>> for trial in protocol.development_trial():
        ...     # obtain path to audio file
        ...     audio = trial['audio']
        ...     # obtain parts of the audio file to use for trial
        ...     try_with = trial['try_with']
        ...     # this is where the trial actually happens
        ...     model_id = trial['model_id']
        ...     score = do_something(audio, try_with, model_id)
        ...     # optionally perform evaluation
        ...     reference = trial['reference']
        ...     metric(reference, score)

        N)r   r%   r-   s      r   Údevelopment_trialz)SpeakerSpottingProtocol.development_trialÊ   r0   r+   c              #   ó`   K  — | j                  «       }|D ]  }| j                  |«      –— Œ y­w)a9  Iterate over the enrolments of the test set

        Yields dictionaries with the followings keys:

        * uri: str
          unique audio file identifier
        * database: str
          unique database identifier
        * model_id: str
          unique model identifier (the same speaker might have different models)
        * enrol_with: pyannote.core.Timeline
          parts of the audio file to use for enrolment

        as well as keys coming from the provided preprocessors (e.g. 'audio')

        Usage
        -----
        >>> models = {}
        >>> for enrolment in protocol.test_enrolment():
        ...     # obtain path to audio file
        ...     audio = enrolment['audio']
        ...     # obtain parts of the audio file to use for enrolment
        ...     enrol_with = enrolment['enrol_with']
        ...     # this is where enrolment actually happens
        ...     model = do_something(audio, enrol_with)
        ...     # store models for later use
        ...     model_id = enrolment['model_id']
        ...     models[model_id] = model

        N)r!   r%   r&   s      r   Útest_enrolmentz&SpeakerSpottingProtocol.test_enrolmentô   r*   r+   c              #   ó`   K  — | j                  «       }|D ]  }| j                  |«      –— Œ y­w)aO  Iterate over the trials of the test set

        Yields dictionaries with the followings keys:

        * uri: str
          unique audio file identifier
        * database: str
          unique database identifier
        * try_with: pyannote.core.Segment, optional
          parts of the audio file where to look for the target speaker.
          default is to use the whole audio file
        * model_id: str
          unique identifier of the target
        * reference: pyannote.core.Timeline
          parts of the audio file where the target actually speaks.
          it might be empty in case of impostor trials.
          in case of genuine trials, it should be contained in `try_with`

        as well as keys coming from the provided preprocessors (e.g. 'audio')

        Usage
        -----
        >>> for trial in protocol.test_trial():
        ...     # obtain path to audio file
        ...     audio = trial['audio']
        ...     # obtain parts of the audio file to use for trial
        ...     try_with = trial['try_with']
        ...     # this is where the trial actually happens
        ...     model_id = trial['model_id']
        ...     score = do_something(audio, try_with, model_id)
        ...     # optionally perform evaluation
        ...     reference = trial['reference']
        ...     metric(reference, score)

        N)r#   r%   r-   s      r   Ú
test_trialz"SpeakerSpottingProtocol.test_trial  r0   r+   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r   r!   r#   r)   r/   r2   r4   r6   r8   r   r   r   r   r   !   sW   „ ñ	ò
ò
òò
ò

ò

ò

ò

ò

ò
#5òJ(1òT#5òJ(1òT#5óJ(1r   r   N)Úspeaker_diarizationr   r   r   r   r   Ú<module>r>      s   ðõ< <ô`1Ð8õ `1r   