I'm trying the speech-to-text method, but the resulting text is in English.
9.0, CommunityToolkit.Maui 11.0
These are my codes:
public async Task<string> MediaToolKitSpeechToTextAsync()
{
var options = new SpeechToTextOptions
{
Culture = CultureInfo.GetCultureInfo("tr-TR")
};
await SpeechToText.Default.StartListenAsync(options, CancellationToken.None);
SpeechToText.Default.RecognitionResultCompleted += (s, args) =>
{
if (args.RecognitionResult != null && !string.IsNullOrEmpty(args.RecognitionResult.Text))
{
transcript = args.RecognitionResult.Text;
}
else
{
MainThread.BeginInvokeOnMainThread(async () =>
{
await DisplayAlert("Hata", "Ses anlaşılamadı.", "Tamam");
});
}
};
return transcript;
}
I'm trying the speech-to-text method, but the resulting text is in English.
9.0, CommunityToolkit.Maui 11.0
These are my codes:
public async Task<string> MediaToolKitSpeechToTextAsync()
{
var options = new SpeechToTextOptions
{
Culture = CultureInfo.GetCultureInfo("tr-TR")
};
await SpeechToText.Default.StartListenAsync(options, CancellationToken.None);
SpeechToText.Default.RecognitionResultCompleted += (s, args) =>
{
if (args.RecognitionResult != null && !string.IsNullOrEmpty(args.RecognitionResult.Text))
{
transcript = args.RecognitionResult.Text;
}
else
{
MainThread.BeginInvokeOnMainThread(async () =>
{
await DisplayAlert("Hata", "Ses anlaşılamadı.", "Tamam");
});
}
};
return transcript;
}
Share
Improve this question
edited Feb 10 at 10:52
Hakan DOĞAN
asked Feb 10 at 10:51
Hakan DOĞANHakan DOĞAN
54 bronze badges
1 Answer
Reset to default 0And finally, I found the bug. I replaced culture with tr_TR and done.
public async Task<string> MediaToolKitSpeechToTextAsync(){
var options = new SpeechToTextOptions
{
Culture = CultureInfo.GetCultureInfo("tr_TR")
};
await SpeechToText.Default.StartListenAsync(options, CancellationToken.None);
SpeechToText.Default.RecognitionResultCompleted += (s, args) =>
{
if (args.RecognitionResult != null && !string.IsNullOrEmpty(args.RecognitionResult.Text))
{
transcript = args.RecognitionResult.Text;
}
else
{
MainThread.BeginInvokeOnMainThread(async () =>
{
await DisplayAlert("Hata", "Ses anlaşılamadı.", "Tamam");
});
}
};
return transcript;
}
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745219851a4617197.html
评论列表(0条)