1 <?xml version="1.0" encoding="UTF-8" ?> 2 <!DOCTYPE supplementalData SYSTEM "../../common/dtd/ldmlSupplemental.dtd"> 3 <!-- 4 Copyright 1991-2013 Unicode, Inc. 5 CLDR data files are interpreted according to the LDML specification (http://unicode.org/reports/tr35/) 6 For terms of use, see http://www.unicode.org/copyright.html 7 --> 8 <supplementalData> 9 <version number="$Revision: 12245 $"/> 10 <transforms> 11 <transform source="Latin" target="NumericPinyin" direction="both" alias="und-pinyin-t-d0-npinyin" backwardAlias="und-pinyin-t-s0-npinyin"> 12 <tRule><![CDATA[ 13 # According to the pinyin definitions I've been able to find: 14 # 'a', 'e' are the preferred bases 15 # otherwise 'o' 16 # otherwise last vowel 17 # The trailing form of syllables are the following: 18 # "a", "ai", "ao", "an", "ang", 19 # "o", "ou", "ong", 20 # "e", "ei", "er", "en", "eng", 21 # "i", "ia", "iao", "ie", "iu", "ian", "in", "iang", "ing", "iong", 22 # "u", "ua", "uo", "uai", "ui", "uan", "un", "uang", "ueng", 23 # "", "e", "an", "n" 24 # so the letters the tone will 'hop' are: 25 ::NFD (NFC); 26 $tone = [] ; 27 # Move the tone to the end of a syllable, and convert to number 28 e {($tone) r} r &Pinyin-NumericPinyin($1); 29 ($tone) ( [i o n u {o n} {n g}]) $2 &Pinyin-NumericPinyin($1); 30 ($tone) &Pinyin-NumericPinyin($1); 31 # The following backs up until it finds the right vowel, then deposits the tone 32 $vowel = [aAeEiIoOuU {u} {U} vV]; 33 $consonant = [[a-z A-Z] - [$vowel]]; 34 $digit = [1-5]; 35 $1 &NumericPinyin-Pinyin($3) $2 ([aAeE]) ($vowel* $consonant*) ($digit); 36 $1 &NumericPinyin-Pinyin($3) $2 ([oO]) ([$vowel-[aeAE]]* $consonant*) ($digit); 37 $1 &NumericPinyin-Pinyin($3) $2 ($vowel) ($consonant*) ($digit); 38 &NumericPinyin-Pinyin($1) [:letter:] {($digit)}; 39 ::NFC (NFD); 40 ]]></tRule> 41 </transform> 42 </transforms> 43 </supplementalData> 44