Share via


PromptBuilder.AppendTextWithHint Méthode

Définition

Ajoute du texte à l'objet PromptBuilder et spécifie le type de contenu du texte.

Surcharges

AppendTextWithHint(String, String)

Ajoute du texte à l'objet PromptBuilder et une String qui spécifie le type de contenu du texte.

AppendTextWithHint(String, SayAs)

Ajoute du texte à l'objet PromptBuilder et spécifie le type de contenu à l'aide d'un membre de l'énumération SayAs.

AppendTextWithHint(String, String)

Ajoute du texte à l'objet PromptBuilder et une String qui spécifie le type de contenu du texte.

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)

Paramètres

textToSpeak
String

Chaîne contenant le texte à énoncer.

sayAs
String

Type de contenu du texte.

Remarques

Vous pouvez utiliser cette méthode pour spécifier un type de contenu qui n’est pas inclus dans l' SayAs énumération. Toutefois, le moteur TTS doit prendre en charge le paramètre que vous spécifiez.

S’applique à

AppendTextWithHint(String, SayAs)

Ajoute du texte à l'objet PromptBuilder et spécifie le type de contenu à l'aide d'un membre de l'énumération SayAs.

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
Public Sub AppendTextWithHint (textToSpeak As String, sayAs As SayAs)

Paramètres

textToSpeak
String

Chaîne contenant le texte à énoncer.

sayAs
SayAs

Type de contenu du texte.

Exemples

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();  
    }  
  }  
}  

Remarques

Le type de contenu spécifié par sayAs peut fournir des conseils au moteur de synthèse vocale sur la manière de prononcer le contenu de textToSpeak .

S’applique à