PromptBuilder.StartParagraph 方法

定義

指定 PromptBuilder 物件中的段落開頭,並選擇性地指定語言。

多載

StartParagraph(CultureInfo)

指定 PromptBuilder 物件中指定文化特性的段落開頭。

StartParagraph()

指定 PromptBuilder 物件中的段落開頭。

備註

如果長提示分成句子和段落,則可以轉譯更像人類語音。

StartParagraph(CultureInfo)

來源:
PromptBuilder.cs
來源:
PromptBuilder.cs
來源:
PromptBuilder.cs

指定 PromptBuilder 物件中指定文化特性的段落開頭。

public:
 void StartParagraph(System::Globalization::CultureInfo ^ culture);
public void StartParagraph (System.Globalization.CultureInfo culture);
member this.StartParagraph : System.Globalization.CultureInfo -> unit
Public Sub StartParagraph (culture As CultureInfo)

參數

culture
CultureInfo

提供特定文化特性的相關資訊,例如語言、文化特性的名稱、書寫系統、使用的行事曆,以及如何格式化日期和排序字串。

備註

如果長提示分成句子和段落,則可以轉譯更像人類語音。

culture段落的參數可以不同于 Culture 包含該段落之 PromptBuilder 物件的 屬性。 實際上,參數的值 culture 將會覆寫 Culture 屬性。 SpeechSynthesizer會嘗試選取已安裝的語音,以支援 參數所 culture 指定的語言來讀出段落。 如果找到具有指定文化特性的語音,則會使用它。 如果找不到具有指定文化特性的語音,則會使用預設語音。 若要停止使用 所 StartParagraph 指定的語音,請呼叫 EndParagraph

若要正確讀出 參數所 culture 指定語言中的單字,必須安裝支援語言的語音合成 (文字轉換語音或 TTS) 引擎。 已安裝的 TTS 引擎稱為語音。 若要取得針對特定文化特性安裝哪些語音的相關資訊,請使用 GetInstalledVoices 方法。

Microsoft Windows 和 System.Speech API 接受所有有效的語言國家/地區代碼作為 的值 culture 。 隨附于 Windows 7 的 TTS 引擎支援下列語言國家/地區代碼:

  • en-US. 英文 (美國)

  • zh-CN. 簡體中文

  • zh-TW。 中文 (台灣)

也允許兩個字母的語言代碼,例如 「en」。

適用於

StartParagraph()

來源:
PromptBuilder.cs
來源:
PromptBuilder.cs
來源:
PromptBuilder.cs

指定 PromptBuilder 物件中的段落開頭。

public:
 void StartParagraph();
public void StartParagraph ();
member this.StartParagraph : unit -> unit
Public Sub StartParagraph ()

範例

下列範例會 PromptBuilder 建立 物件、附加內容,並將內容組織成段落和句子。

using System;  
using System.Speech.Synthesis;  

namespace SampleSynthesis  
{  
  class Program  
  {  
    static void Main(string[] args)  
    {  

      // Initialize a new instance of the SpeechSynthesizer.  
      using (SpeechSynthesizer synth = new SpeechSynthesizer())  
      {  

        // Configure the audio output.   
        synth.SetOutputToDefaultAudioDevice();  

        // Create a PromptBuilder object and add content as paragraphs and sentences.  
        PromptBuilder parSent = new PromptBuilder();  
        parSent.StartParagraph();  
        parSent.StartSentence();  
        parSent.AppendText("Introducing the sentence element.");  
        parSent.EndSentence();  
        parSent.StartSentence();  
        parSent.AppendText("You can use it to mark individual sentences.");  
        parSent.EndSentence();  
        parSent.EndParagraph();  
        parSent.StartParagraph();  
        parSent.AppendText("Another simple paragraph. Sentence structure in this paragraph" +  
          "is not explicitly marked.");  
        parSent.EndParagraph();  

        // Speak the contents of the SSML prompt.  
        synth.Speak(parSent);  
      }  

      Console.WriteLine();  
      Console.WriteLine("Press any key to exit...");  
      Console.ReadKey();  
    }  
  }  
}  

備註

如果長提示分成句子和段落,則可以轉譯更像人類語音。

適用於