Summary:ASTERISK-07623: [patch] Chinese rendition of day-of-month in ast_say_date_with_format_tw is wrong
Reporter:John Williams (sharkey)Labels:
Date Opened:2006-08-29 12:02:51Date Closed:2007-10-15 15:40:21
Versions:Frequency of
Environment:Attachments:( 0) digits.zip
( 1) digits-new.zip
( 2) say.nits.patch
( 3) say.zh.patch
Description:My contacts in China/Taiwan tell me that the way the day-of-month is done by asterisk in chinese is wrong.  The proper way is to say an cardinal number followed by the chinese word for "day".

The current implementation speaks an ordinal number for the day-of-month, and does so in a way which is grammatically incorrect.


The current implementation speaks the day-of-month as an ordinal number in an odd way.  For example, 25th is done with the recordings "digits/h-20h", "digits/h-5"; 17th is "digits/h-10h", "digits/h-7" instead of using "digits/h-17"!

Chinese uses a prefix for ordinal numbers, so a grammatically correct expression would be "h-20", "5".  Using "h-5" as the second recording places the prefix in the middle of the number, which is wrong.  What "h-20h" should contain is not explained any where, and the only readily available collection of sound files in chinese for asterisk (at iaxtalk.com) does not contain any of the "h-%d" files.

The attached patch changes the day-of-month code to do (for example) "digits/20", "digits/5", "digits/day" for the 25th, or "digits/10", "digits/7", "digits/day" for the 17th.
Comments:By: Tilghman Lesher (tilghman) 2006-08-29 12:48:13

I'd like to have confirmation from a native speaker that this "sounds" right, before we commit this patch.  While your description may be technically correct, I'd like to hear that the patch makes the date sound natural (from a native speaker).

By: jimkou (jimkou) 2006-09-05 23:00:15

My mistake. I forgot to release the sound files when I implement this.

The digts.zip is the files you want.

Split the different language sound files is recommend; eg. put english sound file in digits/en, put taiwanese in digits/tw, put chinese in digits/cn and so on.

But, I think it's good idea to change current behavior, which can make file structure and function simplify.

By: pupfuzz (pupfuzz) 2006-09-06 13:53:40

The issue here seems to be regarding the contents of the voice files themselves.  The current (existing) implementation in conjunction with the digits.zip file uploaded by JimKou make sense after listening to the attached gsm files. The current implementation assumes that the Chinese word for "day" is included within the number file itself.  "h-20.gsm" = "20 day", whereas "h-20h.gsm" = "20".

Saying "21 day" would result in "h-20h.gsm" + "h-1.gsm" being played.

Note that h-20h.gsm is redundant, since it is identical to 20.gsm.

sharkey's patch is cleaner and eliminates the above redundancy. It seems to be the better solution. I did not actually apply his patch and listen to the result, however.

I will try to do that by the end of this coming weekend, if that is what it takes before this patch gets committed.

By: jmls (jmls) 2006-11-01 06:40:46.000-0600

pupfuzz, were you able to apply the patch and test it ?

By: pupfuzz (pupfuzz) 2006-11-09 01:02:45.000-0600

I did apply the patch, but was really bitten by the problem of which sound files to use, and perhaps even which version of asterisk is in use. I need to do some more comparison to the original code to see if it's better.

The main problem is really this: there are no official sound files to go along with the code, and the code is dependent on the exact wording in the sound files. Thus, depending on which sound files one chooses to use, you either get something that makes sense, or something that doesn't. I am trying both the attached digits.zip file as well as the Mandarin sound file from iaxtalk at http://iaxtalk.com/index.php?main_page=document_product_info&cPath=10&products_id=14 , and neither yield results I would be happy with as user.

Ideally, one would have to adopt a "standard" set of mandarin chinese language sound files specifying the exact phrase to be spoken in each file, and then build the code around it -- or write the code and specify what is expected in each sound file. Currently, I don't think there's any such specification.

I am using SVN-branch-1.2-r46964M, by the way.

By: John Williams (sharkey) 2007-02-20 12:33:38.000-0600

I faxed my disclaimer on 09-08-06, in response to request for it on issue ASTERISK-7457.
Let me know if you need me to fax it again.

By: Tilghman Lesher (tilghman) 2007-08-13 12:40:52

Given that the license system has undergone a significant revision since then, please submit a new license, using the bugtracker licensing screens and reupload your patch.

By: John Williams (sharkey) 2007-08-13 16:15:13

My disclaimer was good enough for issue 7655, which has been committed.
Do you really want a different disclaimer on file for this issue?

Maybe what I should do is try rearranging JimKou's sound files in a way which will accomodate the structure my patch expects.

By: John Williams (sharkey) 2007-08-13 23:40:10

The date rendition in the current trunk has been much improved, thanks to ljmid in issue ASTERISK-9667.  I recommend this issue be marked duplicate of that and closed.

A couple minor nits (which I will volunteer to fix if there is interest):

1. Still using obsolete "h-1" thru "h-12" files for %m format.  %m should be the same as %b IMO

2. The file containing the units for days is called "ri".  It should be called "digits/day" for consistency with the rest of the code.

By: Tilghman Lesher (tilghman) 2007-08-14 08:13:19

Given that that bug is closed, yes, please provide an updated patch, so this doesn't get lost.

By: John Williams (sharkey) 2007-08-15 23:31:12

I have uploaded say.nits.patch, which fixes the nits I mentioned above.

Also uploaded digits-new.zip, which is JimKou's sound files slightly reorganized.
I clipped the best standalone syllable for "day" from one of the h-* files and put it into day.gsm, and the h-* files were removed.

By: Digium Subversion (svnbot) 2007-10-15 15:00:45

Repository: asterisk
Revision: 85686

U   branches/1.4/main/say.c

r85686 | russell | 2007-10-15 15:00:44 -0500 (Mon, 15 Oct 2007) | 7 lines

Add a small fix for the tw version of saying dates.

(closes issue ASTERISK-7623)
Reported by: sharkey
     say.nits.patch uploaded by sharkey (license 172)


By: Digium Subversion (svnbot) 2007-10-15 15:40:21

Repository: asterisk
Revision: 85718

_U  trunk/
U   trunk/main/say.c

r85718 | russell | 2007-10-15 15:40:20 -0500 (Mon, 15 Oct 2007) | 15 lines

Merged revisions 85686 via svnmerge from

r85686 | russell | 2007-10-15 15:21:27 -0500 (Mon, 15 Oct 2007) | 7 lines

Add a small fix for the tw version of saying dates.

(closes issue ASTERISK-7623)
Reported by: sharkey
     say.nits.patch uploaded by sharkey (license 172)