首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在日语中使用语音合成器?

如何在日语中使用语音合成器?
EN

Stack Overflow用户
提问于 2016-03-21 11:30:38
回答 1查看 821关注 0票数 1

我想用C#创建一个小型的文本到语音转换应用程序。我使用语音合成器和英语,它工作得很好。但是当我通过一个日语句子的时候,它不起作用。我没有收到任何错误消息。我需要安装其他东西吗?

我在Win 7 32位和Win 10 64位上进行了测试。

EN

回答 1

Stack Overflow用户

发布于 2016-03-22 09:18:40

尝试设置应用程序的CultureInfo。

代码语言:javascript
复制
var ci = new System.Globalization.CultureInfo("ja-JP");
System.Threading.Thread.CurrentThread.CurrentCulture = ci;
System.Threading.Thread.CurrentThread.CurrentUICulture = ci;

您可以设置英语或日语,检查CurrentCultureInfo。

代码语言:javascript
复制
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);

我希望这对你有帮助

安东尼奥

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36122687

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档