SayAs Enumeration
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
Enumerates the data formats for the speaking of elements such as times, dates, and currency.
Namespace: Microsoft.SpeechServer.Synthesis
Assembly: Microsoft.SpeechServer (in microsoft.speechserver.dll)
Syntax
'Declaration
Public Enumeration SayAs
public enum SayAs
Members
Member name | Description |
---|---|
Currency | Speak a number as a value in dollars and cents. |
Date | Same as DayMonthYear. |
Day | Speak a date that consists of a day. For example, speak "31" as "thirty-first." |
DayMonth | Speak a date that consists of a day and a month. For example, speak "31/12" as "December thirty-first." |
DayMonthYear | Speak a date that consists of a day, a month, and a year. For example, speak "31-12-2007" as "December thirty-first two thousand seven." |
Month | Speak a date that consists of a month. For example, speak "12" as "December." |
MonthDay | Speak a date that consists of a month and a day. For example, speak "12-31" as "December thirty-first." |
MonthDayYear | Speak a date that consists of a month, a day, and a year. For example, speak "12/31/2007" as "December thirty-first two thousand seven." |
MonthYear | Speak a date that consists of a month and a year. For example, speak "12-2007" as "December two thousand seven." |
NumberCardinal | Speak a number as a cardinal number. For example, speak "3" as "three." |
NumberOrdinal | Speak a number as an ordinal number. For example, speak "3" as "third." |
SpellOut | Spell the word or phrase. |
Telephone | Speak the word or phrase as a U.S. telephone number. |
Text | Speak the word or phrase as text. |
Time | Speak the word or phrase as a time. |
Time12 | Speak a time in 12-hour format. |
Time24 | Speak a time in 24-hour format. |
Year | Speak a date that consists of a year. For example, speak "2007" as "two thousand seven." |
YearMonth | Speak a date that consists of a year and a month. For example, speak "2007/12" as "December two thousand seven." |
YearMonthDay | Speak a date that consists of a year, a month, and a day. For example, speak "2007-12-31" as "December thirty-first two thousand seven." |
Remarks
Members of the SayAs enumeration are typically used in the PromptBuilder.AppendTextWithHint method.
In some cases, such as SayAs.SpellOut, the SayAs member specifies a type of formatting that can be applied to any input data. In the case of time and date elements, SayAs members specify the format of the input data itself and perform simple validation of day, month, second, minute, and hour elements. If the validation of any of these elements fails, the input data is spoken as plain text.
Before attempting to speak date information, AppendTextWithHint ensures that the month element is a number from 1 to 12 and that the day element is a number from 1 to 31. For example, with SayAs.DayMonth, AppendTextWithHint speaks "2/31" as "February thirty-first" but speaks "2/32" as "two slash thirty-two." Combined elements of date information must be separated by dashes or slashes. For example, with SayAs.MonthDay, the date elements "7-4" and "7/4" are spoken as "July fourth", but "7 4" is spoken as "seven four."
SayAs.Currency implies a dollar sign ("$") followed by a numeric value representing dollars and an optional decimal point and two additional digits representing cents.
Example
The following examples demonstrate typical uses of SayAs members.
private void statementActivity1_TurnStarting(object sender, TurnStartingEventArgs e)
{
PromptBuilder pb = new PromptBuilder();
pb.AppendText("These members format complete dates: ");
pb.AppendBreak();
pb.AppendTextWithHint("31/12/2007", Microsoft.SpeechServer.Synthesis.SayAs.Date);
pb.AppendBreak();
pb.AppendTextWithHint("31-12-2007", Microsoft.SpeechServer.Synthesis.SayAs.DayMonthYear);
pb.AppendBreak();
pb.AppendTextWithHint("12/31/2007", Microsoft.SpeechServer.Synthesis.SayAs.MonthDayYear);
pb.AppendBreak();
pb.AppendTextWithHint("2007-12-31", Microsoft.SpeechServer.Synthesis.SayAs.YearMonthDay);
pb.AppendBreak();
statementActivity1.MainPrompt.AppendPromptBuilder(pb);
}
private void statementActivity2_TurnStarting(object sender, TurnStartingEventArgs e)
{
PromptBuilder pb = new PromptBuilder();
pb.AppendText("These members format partial dates: ");
pb.AppendBreak();
pb.AppendTextWithHint("31", Microsoft.SpeechServer.Synthesis.SayAs.Day);
pb.AppendBreak();
pb.AppendTextWithHint("12", Microsoft.SpeechServer.Synthesis.SayAs.Month);
pb.AppendBreak();
pb.AppendTextWithHint("31/12", Microsoft.SpeechServer.Synthesis.SayAs.DayMonth);
pb.AppendBreak();
pb.AppendTextWithHint("12/31", Microsoft.SpeechServer.Synthesis.SayAs.MonthDay);
pb.AppendBreak();
pb.AppendTextWithHint("12-2007", Microsoft.SpeechServer.Synthesis.SayAs.MonthYear);
pb.AppendBreak();
statementActivity2.MainPrompt.AppendPromptBuilder(pb);
}
private void statementActivity3_TurnStarting(object sender, TurnStartingEventArgs e)
{
PromptBuilder pb = new PromptBuilder();
pb.AppendText("These members format times: ");
pb.AppendBreak();
pb.AppendTextWithHint("11:59:59", Microsoft.SpeechServer.Synthesis.SayAs.Time);
pb.AppendBreak();
pb.AppendTextWithHint("11:59:59", Microsoft.SpeechServer.Synthesis.SayAs.Time12);
pb.AppendBreak();
pb.AppendTextWithHint("11:59:59", Microsoft.SpeechServer.Synthesis.SayAs.Time24);
pb.AppendBreak();
statementActivity3.MainPrompt.AppendPromptBuilder(pb);
}
private void statementActivity4_TurnStarting(object sender, TurnStartingEventArgs e)
{
PromptBuilder pb = new PromptBuilder();
pb.AppendText("These members format numbers: ");
pb.AppendBreak();
pb.AppendTextWithHint("3", Microsoft.SpeechServer.Synthesis.SayAs.NumberCardinal);
pb.AppendBreak();
pb.AppendTextWithHint("3", Microsoft.SpeechServer.Synthesis.SayAs.NumberCardinal);
pb.AppendBreak();
pb.AppendTextWithHint("3", Microsoft.SpeechServer.Synthesis.SayAs.NumberOrdinal);
pb.AppendBreak();
pb.AppendTextWithHint("206-555-1212", Microsoft.SpeechServer.Synthesis.SayAs.Telephone);
pb.AppendBreak();
statementActivity4.MainPrompt.AppendPromptBuilder(pb);
}
private void statementActivity5_TurnStarting(object sender, TurnStartingEventArgs e)
{
PromptBuilder pb = new PromptBuilder();
pb.AppendText("These members format text: ");
pb.AppendBreak();
pb.AppendTextWithHint("spelling", Microsoft.SpeechServer.Synthesis.SayAs.Text);
pb.AppendBreak();
pb.AppendTextWithHint("spelling", Microsoft.SpeechServer.Synthesis.SayAs.SpellOut);
pb.AppendBreak();
statementActivity5.MainPrompt.AppendPromptBuilder(pb);
}
private void statementActivity6_TurnStarting(object sender, TurnStartingEventArgs e)
{
PromptBuilder pb = new PromptBuilder();
pb.AppendText("These members format currency: ");
pb.AppendBreak();
pb.AppendTextWithHint("$0", Microsoft.SpeechServer.Synthesis.SayAs.Currency);
pb.AppendBreak();
pb.AppendTextWithHint("$48", Microsoft.SpeechServer.Synthesis.SayAs.Currency);
pb.AppendBreak();
pb.AppendTextWithHint("$.01", Microsoft.SpeechServer.Synthesis.SayAs.Currency);
pb.AppendBreak();
pb.AppendTextWithHint("$1234.56", Microsoft.SpeechServer.Synthesis.SayAs.Currency);
pb.AppendBreak();
statementActivity6.MainPrompt.AppendPromptBuilder(pb);
}
Platforms
Development Platforms
Windows XP Professional with Service Pack 2 (SP2), Windows Server 2003, Windows Vista Ultimate Edition, Windows Vista Business Edition, Windows Vista Enterprise Edition
Target Platforms
Windows Server 2003