• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# © 2016 and later: Unicode, Inc. and others.
2# License & terms of use: http://www.unicode.org/copyright.html
3# Generated using tools/cldr/cldr-to-icu/build-icu-data.xml
4#
5# File: Latin_NumericPinyin.txt
6# Generated from CLDR
7#
8
9# According to the pinyin definitions I've been able to find:
10# 'a', 'e' are the preferred bases
11# otherwise 'o'
12# otherwise last vowel
13# The trailing form of syllables are the following:
14#         "a", "ai", "ao", "an", "ang",
15#         "o", "ou", "ong",
16#         "e", "ei", "er", "en", "eng",
17#         "i", "ia", "iao", "ie", "iu", "ian", "in", "iang", "ing", "iong",
18#         "u", "ua", "uo", "uai", "ui", "uan", "un", "uang", "ueng",
19#         "ü", "üe", "üan", "ün"
20# so the letters the tone will 'hop' are:
21::NFD (NFC);
22$tone = [\u0304\u0301\u030C\u0300\u0306] ;
23# Move the tone to the end of a syllable, and convert to number
24e {($tone) r} → r &Pinyin-NumericPinyin($1);
25($tone) ( [i o n u {o n} {n g}]) → $2 &Pinyin-NumericPinyin($1);
26($tone) → &Pinyin-NumericPinyin($1);
27# The following backs up until it finds the right vowel, then deposits the tone
28$vowel = [aAeEiIoOuU {u\u0308} {U\u0308} vV];
29$consonant = [[a-z A-Z] - [$vowel]];
30$digit = [1-5];
31$1 &NumericPinyin-Pinyin($3) $2 ← ([aAeE]) ($vowel* $consonant*) ($digit);
32$1 &NumericPinyin-Pinyin($3) $2 ← ([oO]) ([$vowel-[aeAE]]* $consonant*) ($digit);
33$1 &NumericPinyin-Pinyin($3) $2 ← ($vowel) ($consonant*) ($digit);
34&NumericPinyin-Pinyin($1) ← [:letter:] {($digit)};
35::NFC (NFD);
36
37