asterisk/say.conf

Fri, 22 Oct 2010 13:22:33 +0200

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 22 Oct 2010 13:22:33 +0200
changeset 271
f45355418dfd
permissions
-rw-r--r--

Import package vendor original specs for necessary manipulations.

     1 ; say.conf
     2 ; 
     3 ; language configuration
     4 ;
     5 ; The new language routines produce strings of the form
     6 ;	prefix:[format:]data
     7 ; that are matched against the rules in this file to produce
     8 ; an output.
     9 ;
    10 ; The data is generally the string to be spelled (either a number,
    11 ; an ascii string or a date/time in the format specified below).
    12 ; It is available, in the right hand side of a rule, as variable ${SAY}.
    13 ;
    14 ; The format is optional and normally used only for date/time.
    15 ; The prefix is used to select the pronunciation - standard
    16 ; prefixes are
    17 ;	num		used for numbers
    18 ;	enum		used for enumerations
    19 ;	date 		for dates
    20 ;	time 		for times
    21 ;	datetime	for dates and times
    22 ;	char		for character strings
    23 ;	phonetic	for phonetic strings
    24 ;	digit		for digit strings
    25 ;
    26 ; but others can be used at will.
    27 ;
    28 ; Processing occurs as follows:
    29 ; If the format is empty, or there is no format, the entire
    30 ; string is matched against one of the pattern on the left hand side.
    31 ; On the first match, the various comma-separated components on the right
    32 ; hand side are pronounced, as follows:
    33 ; + a component starting with a prefix: (i.e. with a ':' in it)
    34 ;   is re-processed according to these rules;
    35 ; + a component without a ':' in it is considered a filename and
    36 ;   the corresponding file is played.
    37 ;
    38 ; If the format is non-empty, the format is split into its components
    39 ; (individual characters, or filenames in single quotes), and then
    40 ; filenames are played, whereas single characters are used to
    41 ; generate a new string format:pat:data to be processed.
    42 ;
    43 ; DATES/AND TIMES assume that the date info is available in
    44 ; the form	 YYYYMMDDHHmm.ss-dow-doy
    45 ; with 4 digits for the year, 2 for month, day, hour, minutes, seconds,
    46 ; one digit for the day-of-week, and 3 digits for the day-of-year.
    47 ;
    48 ; Example:
    49 ;     datetime::200604172030.00-4-102
    50 ; (typical format for a date) is first matched against the line
    51 ;	datetime::. => date:AdBY 'digits/at' IMp:${SAY}
    52 ; which is normally present with the default format for dates.
    53 ; In turn, the format string "AdBY 'digits/at' IMp" results in
    54 ; the sequence
    55 ;	date:A:200604172030.00-4-102
    56 ;	date:d:200604172030.00-4-102
    57 ;	date:B:200604172030.00-4-102
    58 ;	date:Y:200604172030.00-4-102
    59 ;	digits/at
    60 ;	date:I:200604172030.00-4-102
    61 ;	date:M:200604172030.00-4-102
    62 ;	date:p:200604172030.00-4-102
    63 ;
    64 ; 
    65 ; Remember, normally X Z N are special, and the search is
    66 ; case insensitive, so you must use [X] [N] [Z] .. if you
    67 ; want exact match.
    69 ; We start with the basic rules that might be more-or-less
    70 ; language-independent
    72 [digit-base](!)		; base rule for digit strings
    73 			; XXX incomplete yet
    74     _digit:[0-9] => digits/${SAY}
    75     _digit:[-] => letters/dash
    76     _digit:[*] => letters/star
    77     _digit:[@] => letters/at
    78     _digit:[0-9]. => digit:${SAY:0:1}, digit:${SAY:1}
    80 [date-base](!)		; base rules for dates and times
    81     ; the 'SAY' variable contains YYYYMMDDHHmm.ss-dow-doy
    82     ; these rule map the strftime attributes.
    83     _date:Y:. => num:${SAY:0:4}	; year, 19xx
    84     _date:[Bb]:. => digits/mon-$[${SAY:4:2}-1]	; month name, 0..11
    85     _date:[Aa]:. => digits/day-${SAY:16:1}	; day of week
    86     _date:[de]:. => num:${SAY:6:2}		; day of month
    87     _date:[hH]:. => num:${SAY:8:2}		; hour
    88     _date:[I]:. => num:$[${SAY:8:2} % 12]	; hour 0-12
    89     _date:[M]:. => num:${SAY:10:2}		; minute
    90     ; XXX too bad the '?' function does not remove the quotes
    91     ; _date:[pP]:. => digits/$[ ${SAY:10:2} > 12 ? "p-m" :: "a-m"]	; am pm
    92     _date:[pP]:. => digits/p-m	; am pm
    93     _date:[S]:. => num:${SAY:13:2}		; seconds
    95 [en-base](!)
    96     _[n]um:0. => num:${SAY:1}
    97     _[n]um:X => digits/${SAY}
    98     _[n]um:1X => digits/${SAY}
    99     _[n]um:[2-9]0 =>  digits/${SAY}
   100     _[n]um:[2-9][1-9] =>  digits/${SAY:0:1}0, num:${SAY:1}
   101     _[n]um:XXX => num:${SAY:0:1}, digits/hundred, num:${SAY:1}
   103     _[n]um:XXXX => num:${SAY:0:1}, digits/thousand, num:${SAY:1}
   104     _[n]um:XXXXX => num:${SAY:0:2}, digits/thousand, num:${SAY:2}
   105     _[n]um:XXXXXX => num:${SAY:0:3}, digits/thousand, num:${SAY:3}
   107     _[n]um:XXXXXXX => num:${SAY:0:1}, digits/million, num:${SAY:1}
   108     _[n]um:XXXXXXXX => num:${SAY:0:2}, digits/million, num:${SAY:2}
   109     _[n]um:XXXXXXXXX => num:${SAY:0:3}, digits/million, num:${SAY:3}
   111     _[n]um:XXXXXXXXXX => num:${SAY:0:1}, digits/billion, num:${SAY:1}
   112     _[n]um:XXXXXXXXXXX => num:${SAY:0:2}, digits/billion, num:${SAY:2}
   113     _[n]um:XXXXXXXXXXXX => num:${SAY:0:3}, digits/billion, num:${SAY:3}
   115     ; enumeration
   116     _e[n]um:X => digits/h-${SAY}
   117     _e[n]um:1X => digits/h-${SAY}
   118     _e[n]um:[2-9]0 => digits/h-${SAY}
   119     _e[n]um:[2-9][1-9] => num:${SAY:0:1}0, digits/h-${SAY:1}
   120     _e[n]um:[1-9]XX => num:${SAY:0:1}, digits/hundred, enum:${SAY:1}
   122 [it](digit-base,date-base)
   123     _[n]um:0. => num:${SAY:1}
   124     _[n]um:X => digits/${SAY}
   125     _[n]um:1X => digits/${SAY}
   126     _[n]um:[2-9]0 =>  digits/${SAY}
   127     _[n]um:[2-9][1-9] =>  digits/${SAY:0:1}0, num:${SAY:1}
   128     _[n]um:1XX => digits/hundred, num:${SAY:1}
   129     _[n]um:[2-9]XX => num:${SAY:0:1}, digits/hundred, num:${SAY:1}
   131     _[n]um:1XXX => digits/thousand, num:${SAY:1}
   132     _[n]um:[2-9]XXX => num:${SAY:0:1}, digits/thousands, num:${SAY:1}
   133     _[n]um:XXXXX => num:${SAY:0:2}, digits/thousands, num:${SAY:2}
   134     _[n]um:XXXXXX => num:${SAY:0:3}, digits/thousands, num:${SAY:3}
   136     _[n]um:1XXXXXX => num:${SAY:0:1}, digits/million, num:${SAY:1}
   137     _[n]um:[2-9]XXXXXX => num:${SAY:0:1}, digits/millions, num:${SAY:1}
   138     _[n]um:XXXXXXXX => num:${SAY:0:2}, digits/millions, num:${SAY:2}
   139     _[n]um:XXXXXXXXX => num:${SAY:0:3}, digits/millions, num:${SAY:3}
   141     _datetime::. => date:AdBY 'digits/at' IMp:${SAY}
   142     _date::. => date:AdBY:${SAY}
   143     _time::. => date:IMp:${SAY}
   145 [en](en-base,date-base,digit-base)
   146     _datetime::. => date:AdBY 'digits/at' IMp:${SAY}
   147     _date::. => date:AdBY:${SAY}
   148     _time::. => date:IMp:${SAY}
   150 [de](date-base,digit-base)
   151     _[n]um:0. => num:${SAY:1}
   152     _[n]um:X => digits/${SAY}
   153     _[n]um:1X => digits/${SAY}
   154     _[n]um:[2-9]0 => digits/${SAY}
   155     _[n]um:[2-9][1-9] => digits/${SAY:1}-and, digits/${SAY:0:1}0
   156     _[n]um:1XX => digits/ein, digits/hundred, num:${SAY:1}
   157     _[n]um:[2-9]XX => digits/${SAY:0:1}, digits/hundred, num:${SAY:1}
   158     _[n]um:1XXX => digits/ein, digits/thousand, num:${SAY:1}
   159     _[n]um:[2-9]XXX => digits/${SAY:0:1}, digits/thousand, num:${SAY:1}
   160     _[n]um:XXXXX => num:${SAY:0:2}, digits/thousand, num:${SAY:2}
   161     _[n]um:X00XXX => digits/${SAY:0:1}, digits/hundred, digits/thousand, num:${SAY:3}
   162     _[n]um:XXXXXX => digits/${SAY:0:1}, digits/hundred, num:${SAY:1}
   163     _[n]um:1XXXXXX => digits/eine, digits/million, num:${SAY:1}
   164     _[n]um:[2-9]XXXXXX => digits/${SAY:0:1}, digits/millions, num:${SAY:1}
   165     _[n]um:XXXXXXXX => num:${SAY:0:2}, digits/millions, num:${SAY:2}
   166     _[n]um:XXXXXXXXX => num:${SAY:0:3}, digits/millions, num:${SAY:3}
   168     _datetime::. => date:AdBY 'digits/at' IMp:${SAY}
   169     _date::. => date:AdBY:${SAY}
   170     _time::. => date:IMp:${SAY}

mercurial