Merge pull request #8900 from ivandrofly/feature/voskdistate

Feature/voskdistate
This commit is contained in:
Nikolaj Olsson 2024-10-12 18:48:01 +02:00 committed by GitHub
commit ecaa9972f3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -69,7 +69,8 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
_model = new Model(modelFileName); _model = new Model(modelFileName);
} }
var rec = new VoskRecognizer(_model, 16000.0f); using (var rec = new VoskRecognizer(_model, 16000.0f))
{
rec.SetMaxAlternatives(0); rec.SetMaxAlternatives(0);
rec.SetWords(true); rec.SetWords(true);
var list = new List<ResultText>(); var list = new List<ResultText>();
@ -87,7 +88,7 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
} }
else else
{ {
var res = rec.PartialResult(); _ = rec.PartialResult();
} }
} }
} }
@ -108,6 +109,7 @@ namespace Nikse.SubtitleEdit.Forms.AudioToText
return ResultListToText(list); return ResultListToText(list);
} }
}
private static string ResultListToText(List<ResultText> list) private static string ResultListToText(List<ResultText> list)
{ {