我想用C#创建一个小型的文本到语音转换应用程序。我使用语音合成器和英语,它工作得很好。但是当我通过一个日语句子的时候,它不起作用。我没有收到任何错误消息。我需要安装其他东西吗?
我在Win 7 32位和Win 10 64位上进行了测试。
发布于 2016-03-22 09:18:40
尝试设置应用程序的CultureInfo。
var ci = new System.Globalization.CultureInfo("ja-JP");
System.Threading.Thread.CurrentThread.CurrentCulture = ci;
System.Threading.Thread.CurrentThread.CurrentUICulture = ci;您可以设置英语或日语,检查CurrentCultureInfo。
if (currentUICulture == "ja-JP")
{
string colorsString = colors.Aggregate((first, Next) => (first += ";" + Next));
string transColor = speak.Translate(colorsString, "en", "ja");
string[] jaColors = transColor.Split(new char[]{';','、'});
for (int i = 0; i < jaColors.Length; i++)
{
//
}
commands = new string[]{ "なし", "クリア", "イコール",
"プラス", "マイナス", "掛ける", "分割", "追加" };
}
Choices commandsChoices = new Choices(commands);
GrammarBuilder gb = new GrammarBuilder(commandsChoices);
sr.LoadGrammar(new Grammar(gb));
Choices colorChoices = new Choices(colors);
gb = new GrammarBuilder(colorChoices);
sr.LoadGrammar(new Grammar(gb));
sr.SpeechRecognized += new EventHandler<SpeechRecognizedEventArgs>(sr_SpeechRecognized);
sr.SpeechDetected += new EventHandler<SpeechDetectedEventArgs>(sr_SpeechDetected);
sr.SpeechRecognitionRejected += new EventHandler<SpeechRecognitionRejectedEventArgs>(sr_SpeechRecognitionRejected);我希望这对你有帮助
安东尼奥
https://stackoverflow.com/questions/36122687
复制相似问题