in function_app/src/components/speech.py [0:0]
def _determine_auto_phrase_id_format(self) -> tuple[str, str]:
"""
Determines the optimal format for the speaker ID in the phrase format.
"""
speaker_ids = set(
[
str(phrase.speaker)
for phrase in self.phrases
if phrase.speaker is not None
]
)
if len(speaker_ids) > 1:
return PhraseIdMethod.SPEAKER, "speaker"
channel_ids = set(
[
str(phrase.channel)
for phrase in self.phrases
if phrase.channel is not None
]
)
if len(channel_ids) > 1:
return PhraseIdMethod.CHANNEL, "channel"
return PhraseIdMethod.OFFSET_ID, "offset_id"