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