def get_hypothesis(hypotheses, current_file):
    """Get hypothesis for given file

    Parameters
    ----------
    hypotheses : `dict`
        Speaker diarization hypothesis provided by `load_rttm`.
    current_file : `dict`
        File description as given by pyannote.database protocols.

    Returns
    -------
    hypothesis : `pyannote.core.Annotation`
        Hypothesis corresponding to `current_file`.
    """

    uri = current_file['uri']

    if uri in hypotheses:
        return hypotheses[uri]

    # if the exact 'uri' is not available in hypothesis,
    # look for matching substring
    tmp_uri = [u for u in hypotheses if u in uri]

    # no matching speech turns. return empty annotation
    if len(tmp_uri) == 0:
        msg = f'Could not find hypothesis for file "{uri}"; assuming empty file.'
        warnings.warn(msg)
        return Annotation(uri=uri, modality='speaker')

    # exactly one matching file. return it
    if len(tmp_uri) == 1:
        hypothesis = hypotheses[tmp_uri[0]]
        hypothesis.uri = uri
        return hypothesis

    # more that one matching file. error.
    msg = f'Found too many hypotheses matching file "{uri}" ({uris}).'
    raise ValueError(msg.format(uri=uri, uris=tmp_uri))
Get hypothesis for given file

    Parameters
    ----------
    hypotheses : `dict`
        Speaker diarization hypothesis provided by `load_rttm`.
    current_file : `dict`
        File description as given by pyannote.database protocols.

    Returns
    -------
    hypothesis : `pyannote.core.Annotation`
        Hypothesis corresponding to `current_file`.