W3C home > Mailing lists > Public > www-style@w3.org > December 2002

Re: css3-lists: Coptic and Ionic Greek

From: Christos Cheretakis <xalkina@otenet.gr>
Date: Mon, 16 Dec 2002 22:42:27 +0200
Message-ID: <3DFE3AB3.7040700@otenet.gr>
To: Ian Hickson <ian@hixie.ch>
CC: Web Style Sheets W3C Mailing List <www-style@w3.org>
Ian Hickson wrote:
> On Mon, 16 Dec 2002, Christos Cheretakis wrote:
> 
>>As promised, attaching a simple java class that demonstrates the three
>>algorithm variations. I double-checked the arrays, but if there's any
>>inconsintency, please consider the names of the characters to be
>>correct.
> 
> 
> We need to have the spec very clear in English. It would be useful to use
> this program, e.g., to generate the tests for the Lists module test suite,
> but we can't really use it for the spec.
> 

   Using phrasing from the description of the other systems, here you 
go. The steps do not follow my previous implementation. I'm trying to be 
as close to the WD's phrasing.

greek-style(s):

   This is a simple additive system defined for the range 1 to 999999. 
The digits are split into two groups of three (if there are less than 
six digits, the least significant group is filled first). Within each 
group, appropriate digits are picked from the following list (at most 
one per column) and written in descending order by value. Zeros are ignored.

or:

0. If the number is greater than 999999, fallback to decimal

1. Split the decimal number into groups of three digits, starting with 
the least significant digit.

2. For each three-digit group, map the digits, depending on their 
position, according to the following tables. Zero is ignored.

2.1 If there is no mapping for current digit, fallback to decimal

2.5 For readability, include space between groups.

3. If number contains a thousands group, then prepend lower numeral sign.

4. Always append numeral sign.

Please note that steps 2.1 is only valid for modern greek.
Also note that step 2.5 is my addition. Modern greek uses sigma+tau to 
represent 6, but sigma and tau are also used to represent 200 and 300 
respectively. Space does not mean U+0020, as the numbers are written as 
single words. It just means ...space.

Here are the tables:

ancient-greek:

  Ones         Tens         Hundreds
  1   U+03B1 | 10  U+03B9 | 100  U+03C1
  2   U+03B2 | 20  U+03BA | 200  U+03C3
  3   U+03B3 | 30  U+03BB | 300  U+03C4
  4   U+03B4 | 40  U+03BC | 400  U+03C5
  5   U+03B5 | 50  U+03BD | 500  U+03C6
  6   U+03DB | 60  U+03BE | 600  U+03C7
  7   U+03B6 | 70  U+03BF | 700  U+03C8
  8   U+03B7 | 80  U+03C0 | 800  U+03C9
  9   U+03B8 | 90  U+03DF | 900  U+03E1

lower-modern-greek:

  Ones                Tens         Hundreds
  1   U+03B1        | 10  U+03B9 | 100  U+03C1
  2   U+03B2        | 20  U+03BA | 200  U+03C3
  3   U+03B3        | 30  U+03BB | 300  U+03C4
  4   U+03B4        | 40  U+03BC | 400  U+03C5
  5   U+03B5        | 50  U+03BD | 500  U+03C6
  6   U+03C3 U+03C4 | 60  U+03BE | 600  U+03C7
  7   U+03B6        | 70  U+03BF | 700  U+03C8
  8   U+03B7        | 80  U+03C0 | 800  U+03C9
  9   U+03B8        | 90  ------ | 900  ------

upper-modern-greek:

  Ones                Tens         Hundreds
  1   U+0391        | 10  U+0399 | 100  U+03A1
  2   U+0392        | 20  U+039A | 200  U+03A3
  3   U+0393        | 30  U+039B | 300  U+03A4
  4   U+0394        | 40  U+039C | 400  U+03A5
  5   U+0395        | 50  U+039D | 500  U+03A6
  6   U+03A3 U+03A4 | 60  U+039E | 600  U+03A7
  7   U+0396        | 70  U+039F | 700  U+03A8
  8   U+0397        | 80  U+03A0 | 800  U+03A9
  9   U+0398        | 90  ------ | 900  ------

numeral-sign is U+0374
lower-numeral-sign is U+0375

   And some examples, with some, well, well-known numbers. The first 
column contains the names of the digits, the second their unicode 
position and the third an iso-8859-7 representation, but only when *all* 
of the required letters are present in the modern greek alphabet. I use 
"," for the lower-numeral-sign and "'" for the numeral-sign. Oh, and a 
space for "space".


70 would be:
ancient-greek:      omicron' / U+03BF U+0374 / Ο'
lower-modern-greek: omicron' / U+03BF U+0374 / ο'
upper-modern-greek: OMICRON' / U+039F U+0374 / ο'

--------

the number of the beast would be:
ancient-greek:      chi xi stigma'    / U+03C8 U+03BE U+03DB U+0374
lower-modern-greek: chi xi sigma+tau' / U+03C8 U+03BE U+03C3 U+03C4 
U+0374 / χξστ'
upper-modern-greek: CHI XI SIGMA+TAU' / U+03A7 U+039E U+03A3 U+03A4 
U+0374 / ΧΞΣΤ'

(The chi-xi-stigma form is actually feared of in the Apocalypse, so 
don't be fooled by any other representation ;-)

--------

1000 would be:
ancient-greek:      ,alpha' / U+0375 U+03B1 U+0374 / ,α'
lower-modern-greek: ,alpha' / U+0375 U+03B1 U+0374 / ,α'
upper-modern-greek: ,ALPHA' / U+0375 U+0391 U+0374 / ,Α'

--------

6 would be:
ancient-greek:      stigma'    / U+03DB U+0374        /
lower-modern-greek: sigma tau' / U+03C3 U+03C4 U+0374 / στ'
upper-modern-greek: SIGMA TAU' / U+03A3 U+03A4 U+0374 / ΣΤ'

--------

200300 would be:
ancient-greek:      ,sigma tau'       / U+0375 U+03C3 U+03C4 U+0374 / ,στ'
lower-modern-greek: ,sigma space tau' / U+0375 U+03C3 space  U+03C4 
U+0374 / ,σ τ'
upper-modern-greek: ,SIGMA SPACE TAU' / U+0375 U+03A3 space  U+03A4 
U+0374 / ,Σ Τ'

Note: 6 & 200300 could be ambiguous in modern greek, without the space. 
200300 would be ambiguous with 6000 as well...

--------

200306 would be:
ancient-greek:      ,sigma tau stigma'          / U+0375 U+03C3 U+03C4 
U+03DB U+0374 /
lower-modern-greek: ,sigma space tau sigma+tau' / U+0375 U+03C3 space 
U+03C4 U+03C3 U+03C4 U+0374 / ,σ τστ'
upper-modern-greek: ,SIGMA SPACE TAU SIGMA+TAU' / U+0375 U+03A3 space 
U+03A4 U+03A3 U+03A4 U+0374 / ,Σ ΤΣΤ'

--------

6006 would be:
ancient-greek:      ,stigma stigma'             / U+0375 U+03DB U+03DB 
U+0374 /
lower-modern-greek: ,sigma+tau space sigma+tau' / U+0375 U+03C3 U+03C4 
space  U+03C3 U+03C4 U+0374 / ,στ στ'
upper-modern-greek: ,SIGMA+TAU SPACE SIGMA+TAU' / U+0375 U+03A3 U+03A4 
space  U+03A3 U+03A4 U+0374 / 'ΣΤ ΣΤ'

Note: 200306 & 6006 would be ambiguous in modern greek, without the space.

--------

and finally 1821 would be:
ancient-greek:      ,alpha omega kappa alpha'       / U+0375 U+03B1 
U+03C9 U+03BA U+03B1 U+0374 / ,αωκα'
lower-modern-greek: ,alpha space omega kappa alpha' / U+0375 U+03B1 
space  U+03C9 U+03BA U+03B1 U+0374 / ,α ωκα'
upper-modern-greek: ,ALPHA SPACE OMEGA KAPPA ALPHA' / U+0375 U+0391 
SPACE  U+03A9 U+039A U+0391 U+0374 / ,Α ΩΚΑ'

   I'm also attaching a slightly better (and more consistent with the 
above descriptions) version of the java code.

   Hope this helps, Ian. I'll be blaming you for this day of my diploma 
thesis anyways ;-)

	C/

-- 
   Λες κι η στάθμη της αγάπης πάει να βρει                          /"\
   Πόσοι κρύβονται στη λάσπη θησαυροί         ASCII Ribbon Campaign \ /
   Πως κοπήκανε στα δάχτυλα οι σταυροί           against HTML email  X
   Γι' ανθρώπων έργα...                     & microsoft attachments / \

/*
 * GreekNumberGenerator.java
 *
 * Created on 16 Δεκέμβριος 2002, 6:15 μμ
 */

/**
 *
 * @author  xalkina
 */
public class GreekNumberGenerator {

    static final String[] ONES_ANCIENT = {
        "alpha",    // U+03B1
        "beta",     // U+03B2
        "gamma",    // U+03B3
        "delta",    // U+03B4
        "epsilon",  // U+03B5
        "stigma",   // U+03DB
        "zeta",     // U+03B6
        "eta",      // U+03B7
        "theta"     // U+03B8
    };
    static final String[] TENS_ANCIENT = {
        "iota",    // U+03B9
        "kappa",   // U+03BA
        "lamda",   // U+03BB
        "mu",      // U+03BC
        "nu",      // U+03BD
        "xi",      // U+03BE
        "omicron", // U+03BF
        "pi",      // U+03C0
        "koppa"    // U+03DF
    };
    static final String[] HUNDREDS_ANCIENT = {
        "rho",     // U+03C1
        "sigma",   // U+03C3
        "tau",     // U+03C4
        "upsilon", // U+03C5
        "phi",     // U+03C6
        "chi",     // U+03C7
        "psi",     // U+03C8
        "omega",   // U+03C9
        "sampi"    // U+03E1
    };

    static final String[] ONES_LOWER_MODERN = {
        "alpha",       // U+03B1
        "beta",        // U+03B2
        "gamma",       // U+03B3
        "delta",       // U+03B4
        "epsilon",     // U+03B5
        "(sigma+tau)", // U+03C3 U+03C4
        "zeta",        // U+03B6
        "eta",         // U+03B7
        "theta"        // U+03B8
    };
    static final String[] TENS_LOWER_MODERN = {
        "iota",       // U+03B9
        "kappa",      // U+03BA
        "lamda",      // U+03BB
        "mu",         // U+03BC
        "nu",         // U+03BD
        "xi",         // U+03BE
        "omicron",    // U+03BF
        "pi",         // U+03C0
        null
    };
    static final String[] HUNDREDS_LOWER_MODERN = {
        "rho",        // U+03C1
        "sigma",      // U+03C3
        "tau",        // U+03C4
        "upsilon",    // U+03C5
        "phi",        // U+03C6
        "chi",        // U+03C7
        "psi",        // U+03C8
        "omega",      // U+03C9
        null
    };

    static final String[] ONES_UPPER_MODERN = {
        "ALPHA",       // U+0391
        "BETA",        // U+0392
        "GAMMA",       // U+0393
        "DELTA",       // U+0394
        "EPSILON",     // U+0395
        "(SIGMA+TAU)", // U+03A3 U+03A4
        "ZETA",        // U+0396
        "ETA",         // U+0397
        "THETA"        // U+0398
    };
    static final String[] TENS_UPPER_MODERN = {
        "IOTA",        // U+0399
        "KAPPA",       // U+039A
        "LAMDA",       // U+039B
        "MU",          // U+039C
        "NU",          // U+039D
        "XI",          // U+039E
        "OMIKRON",     // U+039F
        "PI",          // U+03A0
        null
    };
    static final String[] HUNDREDS_UPPER_MODERN = {
        "RHO",         // U+03A1
        "SIGMA",       // U+03A3
        "TAU",         // U+03A4
        "UPSILON",     // U+03A5
        "PHI",         // U+03A6
        "CHI",         // U+03A7
        "PSI",         // U+03A8
        "OMEGA",       // U+03A9
        null
    };

    static final String LOWER_NUMERAL_SIGN = "(lnsign)"; // U+0375

    static final String NUMERAL_SIGN = "(nsign)"; // U+0374

    public static String generateAncientGreekNumber(int number) {
        String[][] symbols = new String[6][];
        StringBuffer representation = new StringBuffer();

        int current_digit;
        int position;
        int number_copy = number;

        symbols[0] = symbols[3] = ONES_ANCIENT;
        symbols[1] = symbols[4] = TENS_ANCIENT;
        symbols[2] = symbols[5] = HUNDREDS_ANCIENT;

        if (number >= 1000000) {
            return null;
        }

        position = 0;
        do {
            current_digit = number_copy % 10;
            if (current_digit > 0) {
                representation.insert(0, symbols[position][current_digit-1]);
            }
            number_copy /= 10;
            ++position;
        } while (number_copy != 0);

        if (number >= 1000) {
            representation.insert(0, LOWER_NUMERAL_SIGN);
        }

        representation.append(NUMERAL_SIGN);

        return new String(representation);
    }

    public static String generateLowerModernGreekNumber(int number) {
        String[][] symbols = new String[6][];
        StringBuffer representation = new StringBuffer();

        int current_digit;
        int position;
        int number_copy = number;

        symbols[0] = symbols[3] = ONES_LOWER_MODERN;
        symbols[1] = symbols[4] = TENS_LOWER_MODERN;
        symbols[2] = symbols[5] = HUNDREDS_LOWER_MODERN;

        if (number >= 1000000) {
            return null;
        }

        position = 0;
        do {
            if (position == 3) {
                representation.insert(0, ' ');
            }
            current_digit = number_copy % 10;
            if (current_digit > 0) {
                if (symbols[position][current_digit-1] == null) {
                    return null;
                }
                representation.insert(0, symbols[position][current_digit-1]);
            }
            number_copy /= 10;
            ++position;
        } while (number_copy != 0);

        if (number >= 1000) {
            representation.insert(0, LOWER_NUMERAL_SIGN);
        }

        representation.append(NUMERAL_SIGN);

        return new String(representation);
    }

    public static String generateUpperModernGreekNumber(int number) {
        String[][] symbols = new String[6][];
        StringBuffer representation = new StringBuffer();

        int current_digit;
        int position;
        int number_copy = number;

        symbols[0] = symbols[3] = ONES_UPPER_MODERN;
        symbols[1] = symbols[4] = TENS_UPPER_MODERN;
        symbols[2] = symbols[5] = HUNDREDS_UPPER_MODERN;

        if (number >= 1000000) {
            return null;
        }

        position = 0;
        do {
            if (position == 3) {
                representation.insert(0, ' ');
            }
            current_digit = number_copy % 10;
            if (current_digit > 0) {
                if (symbols[position][current_digit-1] == null) {
                    return null;
                }
                representation.insert(0, symbols[position][current_digit-1]);
            }
            number_copy /= 10;
            ++position;
        } while (number_copy != 0);

        if (number >= 1000) {
            representation.insert(0, LOWER_NUMERAL_SIGN);
        }

        representation.append(NUMERAL_SIGN);

        return new String(representation);
    }

    public static void main(String[] argv) {
        int number;
        String representation;

        for (int i = 0; i < argv.length; ++i) {
            number = Integer.parseInt(argv[i]);
            System.out.println(number + " is ");

            representation = generateAncientGreekNumber(number);
            System.out.print("ancient-greek: ");
            if (representation != null) {
                System.out.println(" " + representation);
            }
            else {
                System.out.println(" no representation");
            }

            representation = generateLowerModernGreekNumber(number);
            System.out.print("lower-modern-greek: ");
            if (representation != null) {
                System.out.println(" " + representation);
            }
            else {
                System.out.println(" no representation");
            }

            representation = generateUpperModernGreekNumber(number);
            System.out.print("upper-modern-greek: ");
            if (representation != null) {
                System.out.println(" " + representation);
            }
            else {
                System.out.println(" no representation");
            }

            System.out.println("------------------------");
        }
    }
}
Received on Monday, 16 December 2002 15:46:09 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:18 GMT