o
    pi7!                     @   s    d dl mZ G dd deZdS )   )Protocolc                   @   s   e Zd ZdZdd Zdd Zdd Zdd	 Zd
d Zdd Z	dd Z
dd Zdd Zdd Zd-ddZd.ddZd.ddZdd Zd.d d!Zd.d"d#Zd$d% Zd.d&d'Zd.d(d)Zd*d+ Zd,S )/SpeakerRecognitionProtocola  Speaker recognition 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. {'wav': '/path/to/{uri}.wav'})
    c                 C      t d)Nz@Custom speaker recognition protocol should implement "trn_iter".NotImplementedErrorself r	   b/home/ubuntu/.local/lib/python3.10/site-packages/pyannote/database/protocol/speaker_recognition.pytrn_iter-      z#SpeakerRecognitionProtocol.trn_iterc                 C   r   )NzGCustom speaker recognition protocol should implement "trn_enroll_iter".r   r   r	   r	   r
   trn_enroll_iter2   r   z*SpeakerRecognitionProtocol.trn_enroll_iterc                 C   r   )NzECustom speaker recognition protocol should implement "trn_test_iter".r   r   r	   r	   r
   trn_test_iter7   r   z(SpeakerRecognitionProtocol.trn_test_iterc                 C   r   )Nz@Custom speaker recognition protocol should implement "trn_keys".r   r   r	   r	   r
   trn_keys<   r   z#SpeakerRecognitionProtocol.trn_keysc                 C   r   )NzGCustom speaker recognition protocol should implement "dev_enroll_iter".r   r   r	   r	   r
   dev_enroll_iterA   r   z*SpeakerRecognitionProtocol.dev_enroll_iterc                 C   r   )NzECustom speaker recognition protocol should implement "dev_test_iter".r   r   r	   r	   r
   dev_test_iterF   r   z(SpeakerRecognitionProtocol.dev_test_iterc                 C   r   )Nz@Custom speaker recognition protocol should implement "dev_keys".r   r   r	   r	   r
   dev_keysK   r   z#SpeakerRecognitionProtocol.dev_keysc                 C   r   )NzGCustom speaker recognition protocol should implement "tst_enroll_iter".r   r   r	   r	   r
   tst_enroll_iterP   r   z*SpeakerRecognitionProtocol.tst_enroll_iterc                 C   r   )NzECustom speaker recognition protocol should implement "tst_test_iter".r   r   r	   r	   r
   tst_test_iterU   r   z(SpeakerRecognitionProtocol.tst_test_iterc                 C   r   )Nz?Custom speaker recognition protocol should implement tst_keys".r   r   r	   r	   r
   tst_keysZ   r   z#SpeakerRecognitionProtocol.tst_keysFc                 c   >    |   }|D ]\}}|r|| |fV  q| |V  qdS )a  Iterate over the training set

This will yield dictionaries with the followings keys:

* database: str
  unique database identifier
* uri: str
  unique recording identifier
* channel: int
  index of resource channel to use
* speaker: str
  unique speaker identifier

as well as keys coming from the provided preprocessors.

Usage
-----
>>> for item in protocol.train():
...     uri = item['uri']
...     channel = item['channel']
...     speaker = item['speaker']
        N)r   
preprocessr   
yield_name	generatornameitemr	   r	   r
   train_      z SpeakerRecognitionProtocol.trainTc                 c   r   )a  Iterate over the training set enrollments

This will yield dictionaries with the followings keys:

* database: str
  unique database identifier
* uri: str
  uniform (or unique) resource identifier
* channel: int
  index of resource channel to use

as well as keys coming from the provided preprocessors.

Usage
-----
>>> for item in protocol.train_enroll():
...     uri = item['uri']
...     channel = item['channel']
        N)r   r   r   r	   r	   r
   train_enroll      z'SpeakerRecognitionProtocol.train_enrollc                 c   r   )a  Iterate over the training set tests

This will yield dictionaries with the followings keys:

* database: str
  unique database identifier
* uri: str
  uniform (or unique) resource identifier
* channel: int
  index of resource channel to use

as well as keys coming from the provided preprocessors.

Usage
-----
>>> for item in protocol.train_test():
...     uri = item['uri']
...     channel = item['channel']
        N)r   r   r   r	   r	   r
   
train_test   r    z%SpeakerRecognitionProtocol.train_testc                 C      |   S N)r   r   r	   r	   r
   
train_keys      z%SpeakerRecognitionProtocol.train_keysc                 c   r   )a  Iterate over the development set enrollments

This will yield dictionaries with the followings keys:

* database: str
  unique database identifier
* uri: str
  uniform (or unique) resource identifier
* channel: int
  index of resource channel to use

as well as keys coming from the provided preprocessors.

Usage
-----
>>> for item in protocol.development_enroll():
...     uri = item['uri']
...     channel = item['channel']
        N)r   r   r   r	   r	   r
   development_enroll   r    z-SpeakerRecognitionProtocol.development_enrollc                 c   r   )a  Iterate over the development set tests

This will yield dictionaries with the followings keys:

* database: str
  unique database identifier
* uri: str
  uniform (or unique) resource identifier
* channel: int
  index of resource channel to use

as well as keys coming from the provided preprocessors.

Usage
-----
>>> for item in protocol.development_test():
...     uri = item['uri']
...     channel = item['channel']
        N)r   r   r   r	   r	   r
   development_test   r    z+SpeakerRecognitionProtocol.development_testc                 C   r"   r#   )r   r   r	   r	   r
   development_keys   r%   z+SpeakerRecognitionProtocol.development_keysc                 c   r   )a  Iterate over the test set targets

This will yield dictionaries with the followings keys:

* database: str
  unique database identifier
* uri: str
  uniform (or unique) resource identifier
* channel: int
  index of resource channel to use
* speaker: str
  unique speaker identifier

as well as keys coming from the provided preprocessors.

Usage
-----
>>> for item in protocol.test_enroll():
...     uri = item['uri']
...     channel = item['channel']
...     speaker = item['speaker']
        N)r   r   r   r	   r	   r
   test_enroll   r   z&SpeakerRecognitionProtocol.test_enrollc                 c   r   )a  Iterate over the test set tests

This will yield dictionaries with the followings keys:

* database: str
  unique database identifier
* uri: str
  uniform (or unique) resource identifier
* channel: int
  index of resource channel to use

as well as keys coming from the provided preprocessors.

Usage
-----
>>> for item in protocol.test_test():
...     uri = item['uri']
...     channel = item['channel']
        N)r   r   r   r	   r	   r
   	test_test  r    z$SpeakerRecognitionProtocol.test_testc                 C   r"   r#   )r   r   r	   r	   r
   	test_keys6  r%   z$SpeakerRecognitionProtocol.test_keysN)F)T)__name__
__module____qualname____doc__r   r   r   r   r   r   r   r   r   r   r   r   r!   r$   r&   r'   r(   r)   r*   r+   r	   r	   r	   r
   r   !   s,    

 




 r   N)protocolr   r   r	   r	   r	   r
   <module>   s   