Files
codex a72cda0c03
PR and Push Build/Test / build-and-test (push) Successful in 7m0s
Harden speaker identity samples
2026-05-28 12:02:44 +02:00

106 lines
3.1 KiB
C#

using MeetingAssistant.MeetingNotes;
using MeetingAssistant.Transcription;
namespace MeetingAssistant.Speakers;
public sealed record SpeakerIdentificationRequest(
string AudioPath,
MeetingNote MeetingNote,
IReadOnlyList<TranscriptionSegment> Segments,
IReadOnlyList<SpeakerAudioSample>? Samples = null,
IReadOnlyDictionary<string, string>? KnownSpeakerMappings = null);
public sealed record SpeakerAudioSample(
string Speaker,
TranscriptionSegment Segment,
byte[] WavBytes,
double Score);
public sealed record SpeakerIdentificationResult(
IReadOnlyList<TranscriptionSegment> Segments,
IReadOnlyDictionary<string, string> SpeakerMappings,
IReadOnlyList<SpeakerIdentityAttendeeMatch>? AttendeeMatches = null);
public sealed record SpeakerIdentityAttendeeMatch(
string DisplayName,
IReadOnlyList<string> AcceptedNames);
public sealed record SpeakerIdentityMatchRequest(
string DiarizedSpeaker,
byte[] UnknownSnippet,
IReadOnlyList<SpeakerIdentityMatchCandidate> Candidates);
public sealed record SpeakerIdentityMatchCandidate(
int IdentityId,
string? CanonicalName,
int ReferenceCount,
IReadOnlyList<byte[]> Snippets);
public sealed record SpeakerIdentityMatch(int IdentityId);
public sealed record SpeakerIdentityMatchValidationRequest(
string DiarizedSpeaker,
int IdentityId,
byte[] UnknownSnippet,
IReadOnlyList<byte[]> KnownSnippets);
public interface ISpeakerIdentityMatcher
{
Task<SpeakerIdentityMatch?> MatchAsync(
SpeakerIdentityMatchRequest request,
CancellationToken cancellationToken);
}
public interface ISpeakerIdentityMatchValidator
{
Task<bool> ValidateSampleAsync(
byte[] wavBytes,
CancellationToken cancellationToken);
Task<bool> ValidateMatchAsync(
SpeakerIdentityMatchValidationRequest request,
CancellationToken cancellationToken);
}
public interface ISpeakerSnippetExtractor
{
Task<byte[]> ExtractSnippetAsync(
string audioPath,
IReadOnlyList<TranscriptionSegment> speakerSegments,
CancellationToken cancellationToken);
}
public interface ISpeakerIdentificationService
{
Task<SpeakerIdentificationResult> IdentifyKnownSpeakersAsync(
SpeakerIdentificationRequest request,
CancellationToken cancellationToken);
Task<SpeakerIdentificationResult> IdentifyFinishedSpeakersAsync(
SpeakerIdentificationRequest request,
CancellationToken cancellationToken)
{
return IdentifyKnownSpeakersAsync(request, cancellationToken);
}
Task ApplySpeakerOverrideAsync(
SpeakerIdentificationRequest request,
string sourceSpeaker,
string targetSpeaker,
CancellationToken cancellationToken)
{
return Task.CompletedTask;
}
Task DeleteSpeakerIdentityAsync(
string identity,
CancellationToken cancellationToken)
{
return Task.CompletedTask;
}
Task<SpeakerIdentificationResult> ProcessFinishedTranscriptAsync(
SpeakerIdentificationRequest request,
CancellationToken cancellationToken);
}