【问题标题】:Is it possible to set additional languages using C# package Google.Cloud.Speech.V1P1Beta1?是否可以使用 C# 包 Google.Cloud.Speech.V1P1Beta1 设置其他语言?
【发布时间】:2018-10-25 08:21:49
【问题描述】:

是否可以在 RecognitionConfig.AlternativeLanguageCodes 中使用 C# 包 Google.Cloud.Speech.V1P1Beta1 设置其他语言?

在 1.0.0-beta02 版本中,我看到此字段仅可读,尽管在 Google Cloud 文档中提到,我们最多可以设置三种其他语言。

我该怎么做?有谁知道,这个包有更新的版本吗?

【问题讨论】:

  • 欢迎来到 Stakoverflow 你做了任何研究吗?你能表现出你的一些努力吗...
  • 非常感谢!我试图在nuget.org/packages/Google.Cloud.Speech.V1P1Beta1 上搜索新版本,但我知道它是最新版本...
  • 这里是 RecognitionConfig var response = speech.Recognize(new RecognitionConfig { Encoding = RecognitionConfig.Types.AudioEncoding.Flac, SampleRateHertz = 16000, EnableWordTimeOffsets = true, LanguageCode = "ru-RU", EnableSpeakerDiarization = true, MaxAlternatives = 1, //AlternativeLanguageCodes = ???, AudioChannelCount = 1, EnableWordConfidence = true, }, RecognitionAudio.FromFile(test_file_path));

标签: c# speech-to-text


【解决方案1】:

下面的示例代码应该可以帮助您进行操作

var RecogCfg = new Google.Cloud.Speech.V1P1Beta1.RecognitionConfig {

       // Encoding = EncodeType,
        //SampleRateHertz = Int32.Parse(SampleRate),                
        LanguageCode = Lang,
       // EnableAutomaticPunctuation = true,
        //EnableWordTimeOffsets = true,
        MaxAlternatives = 5,
        Model= "default"
    };

    //add one or more alternative language codes
    RecogCfg.AlternativeLanguageCodes.Add("<Language Code 1>");
    RecogCfg.AlternativeLanguageCodes.Add("<Language Code 2>");

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多