PromptBuilder.AppendTextWithHint PromptBuilder.AppendTextWithHint PromptBuilder.AppendTextWithHint PromptBuilder.AppendTextWithHint Method

定义

PromptBuilder 对象追加文本,并指定该文本的内容类型。Appends text to the PromptBuilder object and specifies the content type of the text.

重载

AppendTextWithHint(String, String) AppendTextWithHint(String, String) AppendTextWithHint(String, String) AppendTextWithHint(String, String)

将文本追加到 PromptBuilder 对象本,String 指定该文本的内容类型。Appends text to the PromptBuilder object and a String that specifies the content type of the text.

AppendTextWithHint(String, SayAs) AppendTextWithHint(String, SayAs) AppendTextWithHint(String, SayAs)

将文本追加到 PromptBuilder 对象,并使用 SayAs 枚举的成员指定内容类型。Appends text to the PromptBuilder object and specifies the content type using a member of the SayAs enumeration.

AppendTextWithHint(String, String) AppendTextWithHint(String, String) AppendTextWithHint(String, String) AppendTextWithHint(String, String)

将文本追加到 PromptBuilder 对象本,String 指定该文本的内容类型。Appends text to the PromptBuilder object and a String that specifies the content type of the text.

public:
 void AppendTextWithHint(System::String ^ textToSpeak, System::String ^ sayAs);
public void AppendTextWithHint (string textToSpeak, string sayAs);
member this.AppendTextWithHint : string * string -> unit
Public Sub AppendTextWithHint (textToSpeak As String, sayAs As String)

参数

textToSpeak
String String String String

包含要发言文本的字符串。A string containing the text to be spoken.

sayAs
String String String String

文本的内容类型。The content type of the text.

注解

您可以使用此方法来指定SayAs枚举中未包含的内容类型。You can use this method to specify a content type that is not included in the SayAs enumeration. 但是, TTS 引擎必须支持您指定的参数。However, the TTS engine must support the parameter that you specify.

AppendTextWithHint(String, SayAs) AppendTextWithHint(String, SayAs) AppendTextWithHint(String, SayAs)

将文本追加到 PromptBuilder 对象,并使用 SayAs 枚举的成员指定内容类型。Appends text to the PromptBuilder object and specifies the content type using a member of the SayAs enumeration.

public:
 void AppendTextWithHint(System::String ^ textToSpeak, System::Speech::Synthesis::SayAs sayAs);
public void AppendTextWithHint (string textToSpeak, System.Speech.Synthesis.SayAs sayAs);
member this.AppendTextWithHint : string * System.Speech.Synthesis.SayAs -> unit

参数

textToSpeak
String String String String

包含要发言文本的字符串。A string containing the text to be spoken.

sayAs
SayAs SayAs SayAs SayAs

文本的内容类型。The content type of the text.

示例

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 define the data types for some of the added strings.  
        PromptBuilder sayAs = new PromptBuilder();  
        sayAs.AppendText("Your");  
        sayAs.AppendTextWithHint("1st", SayAs.NumberOrdinal);  
        sayAs.AppendText("request was for");  
        sayAs.AppendTextWithHint("1", SayAs.NumberCardinal);  
        sayAs.AppendText("room, on");  
        sayAs.AppendTextWithHint("10/19/2012,", SayAs.MonthDayYear);  
        sayAs.AppendText("with early arrival at");  
        sayAs.AppendTextWithHint("12:35pm", SayAs.Time12);  

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

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

注解

指定sayAs的内容类型可以为语音合成引擎提供有关如何对的textToSpeak内容进行发音的指导。The content type specified by sayAs can provide guidance to the speech synthesis engine about how to pronounce the contents of textToSpeak.

适用于