blob: ab8df116f88dc29406580b83f5644384ad8c9690 [file] [log] [blame]
 // -*- Coding: utf-8; -*-
//--------------------------------------------------------------------
// Copyright (c) 1999-2004, International Business Machines
// Corporation and others. All Rights Reserved.
//--------------------------------------------------------------------
// THIS IS A MACHINE-GENERATED FILE
// Tool: \icu4j\src\com\ibm\icu\dev\tool\translit\dumpICURules.bat
// Source: \icu4j\src\com\ibm\icu\impl\data/Transliterator_Latin_NumericPinyin.txt
// Date: Fri May 28 17:07:31 2004
//--------------------------------------------------------------------
// Latin_NumericPinyin
t_Latn_NPinyn {
Rule {
//--------------------------------------------------------------------
//--------------------------------------------------------------------
// According to the pinyin definitions I've been able to find:
// 'a', 'e' are the preferred bases
// otherwise 'o'
// otherwise last vowel
// The trailing form of syllables are the following:
// "a", "ai", "ao", "an", "ang",
// "o", "ou", "ong",
// "e", "ei", "er", "en", "eng",
// "i", "ia", "iao", "ie", "iu", "ian", "in", "iang", "ing", "iong",
// "u", "ua", "uo", "uai", "ui", "uan", "un", "uang", "ueng",
// "ü", "üe", "üan", "ün"
// so the letters the tone will 'hop' are:
"::NFD (NFC);"
"$tone = [\u0304\u0301\u030C\u0300\u0306] ;"
// Move the tone to the end of a syllable, and convert to number
"e {($tone) r} > r &tone-digit($1);"
"($tone) ( [i o n u {o n} {n g}]) > $2 &tone-digit($1);"
"($tone) > &tone-digit($1);"
// The following backs up until it finds the right vowel, then deposits the tone
"$vowel = [aAeEiIoOuUüÜ];"
"$consonant = [[a-z A-Z] - [$vowel]];"
"$digit = [1-5];"
"$1 &digit-tone($3) $2 < ([aAeE]) ($vowel* $consonant*) ($digit);"
"$1 &digit-tone($3) $2 < ([oO]) ([$vowel-[aeAE]]* $consonant*) ($digit);"
"$1 &digit-tone($3) $2 < ($vowel) ($consonant*) ($digit);"
"&digit-tone($1) < [:letter:] {($digit)};"
"::NFC (NFD);"
}
}