private void CountErrorRates(ref Transcription transcription) { if (transcription.MetricsId.HasValue) { transcription.Metrics.WordErrorRate = StringDistance.CountWordErrorRate(transcription.AgentTranscription, transcription.DeepSpeechTranscription); transcription.Metrics.CharErrorRate = StringDistance.CountCharErrorRate(transcription.AgentTranscription, transcription.DeepSpeechTranscription); } }
private async Task SaveVerifiedTranscription(TranscriptionModel transcriptionModel, long agentId) { var transcription = await transcriptionRepository.GetAsync(transcriptionModel.Id); transcription.WordErrorRate = StringDistance.CountWordErrorRate(transcriptionModel.AgentTranscription, transcription.AgentTranscription); mapper.Map(transcriptionModel, transcription); transcription.VerifierId = agentId; transcription.VerificationTime = DateTime.UtcNow; transcription.InUse = false; CountErrorRates(ref transcription); await transcriptionRepository.UpdateAsync(transcription); }