Public Access
89 lines
2.6 KiB
C#
89 lines
2.6 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 interface ISpeakerIdentityMatcher
|
|
{
|
|
Task<SpeakerIdentityMatch?> MatchAsync(
|
|
SpeakerIdentityMatchRequest 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);
|
|
}
|