Asterisk
  1. Asterisk
  2. ASTERISK-5527

[patches for review/feedback] [post 1.2] say.c rewrite.

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Severity: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Target Release Version/s: None
    • Component/s: Core/General
    • Labels:
      None
    • Mantis ID:
      5675
    • Regression:
      No

      Description

      as announced, i am working on a rewrite of say.c to make it easier to
      maintain. I am submitting here a snapshot of the current code for review.
      THIS IS ONLY FOR REVIEW AND FEEDBACK, NOT MEANT TO BE COMMITTED NOW

      If you want to try it, expand the tgz in the asterisk/ directory
      (WATCH OUT IT WILL OVERWRITE YOUR say.c), apply the patch say.Makefile.patch
      to the Makefile in the same directory.
      You also have to change the first argument to ast_localtime in say.c, i think
      it is just a couple of instances (trivial).
      The code is now broken in one main part (say.c) plus language-specific files
      which reside in the subdirectory say/ and are included by the main file.
      The main file say.c is also largely commented explaining how the various
      language-specific parts should be written.
      If you are a native speaker and have corrections to the individual files,
      please send them to me at rizzo at icir dot org so i can incorporate them.

                • ADDITIONAL INFORMATION ******

      Right now i have only split the file, cleaned up a bit the interfaces,
      and documented the main part. I have tested the english variant and
      it seems to work - have not tried other languages.
      In the process i have found and removed a lot of minor bugs (such as nl
      functions calling english functions in the middle of their body,
      and the same from danish to german and possibly a few more) but not
      tested the grammar as i don't speak most of the languages.

      TODO:
      + add back copyrights to the individual files (they are under the same
      copyright as the main file)
      + cleanup interfaces so they use say_args_t as the first argument in the
      same way as say_number_full_*();
      + reduce the variety of different methods used to stream a file - the
      code currently uses 4, probably just one is enough;
      + implement the date/time functions as instances of say_date_with_format()
      with specific formats
      and probably a lot more redundancy removal once i have figured out
      more common parts.

      1. say.20051111b.tgz
        22 kB
      2. say-20051109.tgz
        24 kB
      3. say-20051110.tgz
        22 kB
      4. say-20051115a.tgz
        22 kB

        Activity

        Hide
        Igor Goncharovsky added a comment -

        I send new say_ru.c to email. SayNumbers work well, but i have not test date and enumeration, i am waiting for sound files.

        One note: may be we will continue execute dial plan while any soun files is missed? Now when we can try to use mised sound dialplan execution stoped...

        Show
        Igor Goncharovsky added a comment - I send new say_ru.c to email. SayNumbers work well, but i have not test date and enumeration, i am waiting for sound files. One note: may be we will continue execute dial plan while any soun files is missed? Now when we can try to use mised sound dialplan execution stoped...
        Hide
        Peng Yong added a comment -

        Chinese locale name standardlise:

        http://bugs.digium.com/view.php?id=6135

        Show
        Peng Yong added a comment - Chinese locale name standardlise: http://bugs.digium.com/view.php?id=6135
        Hide
        benjk added a comment -

        please keep in mind that there are languages where counted objects cannot be constructed from "number" + "object" such as is the case in Japanese for example ...

        one day:
        Chinese originated word for "one" plus Chinese originated word for "day"

        BUT ...

        two days:
        Japanese native word for "two" minus last syllable plus Japanese native word for "day"

        three days:

        Japanese native word for "three" blended together with Japanese native word for "day"

        ten days:
        Japanese native word for "ten" plus Japanese native word for "day"

        eleven days:
        Chinese originated word for "ten" plus Chinese originated word for "one" plus Chinese orginated word for "day"

        twenty days:
        special word for "twenty" only ever used in this context plus Japanese native word for "day"

        twenty-four days:
        Chinese originated word for "twenty" plus Japanese native word for "four" minus last consonant plus Chinese originated word for "day"

        twenty-seven fays:
        Chinese originated word for "twenty" plus Chinese originated word for "seven" plus Chinese originated word for "day"

        ... which is irregular of sorts because normally twenty-seven would be Chinese originated word for "twenty" plus Japanese native word for "seven"

        There are many more oddities in Japanese counting rules which render any system that simply uses number + object to construct the text unusable for Japanese. Other languages outside of the Latin/Greek influenced group of languages have their own often incompatible rules.

        I am all for simplification, but in this case we have to take the large variety of foreign languages into account.

        Show
        benjk added a comment - please keep in mind that there are languages where counted objects cannot be constructed from "number" + "object" such as is the case in Japanese for example ... one day: Chinese originated word for "one" plus Chinese originated word for "day" BUT ... two days: Japanese native word for "two" minus last syllable plus Japanese native word for "day" three days: Japanese native word for "three" blended together with Japanese native word for "day" ten days: Japanese native word for "ten" plus Japanese native word for "day" eleven days: Chinese originated word for "ten" plus Chinese originated word for "one" plus Chinese orginated word for "day" twenty days: special word for "twenty" only ever used in this context plus Japanese native word for "day" twenty-four days: Chinese originated word for "twenty" plus Japanese native word for "four" minus last consonant plus Chinese originated word for "day" twenty-seven fays: Chinese originated word for "twenty" plus Chinese originated word for "seven" plus Chinese originated word for "day" ... which is irregular of sorts because normally twenty-seven would be Chinese originated word for "twenty" plus Japanese native word for "seven" There are many more oddities in Japanese counting rules which render any system that simply uses number + object to construct the text unusable for Japanese. Other languages outside of the Latin/Greek influenced group of languages have their own often incompatible rules. I am all for simplification, but in this case we have to take the large variety of foreign languages into account.
        Hide
        crich added a comment -

        Please have a look at ASTERISK-6050 which implements a generic way of saying numbers. we could make such thing for the date stuff also ..

        Show
        crich added a comment - Please have a look at ASTERISK-6050 which implements a generic way of saying numbers. we could make such thing for the date stuff also ..
        Hide
        Luigi Rizzo added a comment -

        this patch has been superceded by the one in ASTERISK-6050 which is a much
        better way of handling the problem.

        Show
        Luigi Rizzo added a comment - this patch has been superceded by the one in ASTERISK-6050 which is a much better way of handling the problem.

          People

          • Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development