summaryrefslogtreecommitdiff
path: root/src/zope/i18n/locales/data/transforms/Latin-NumericPinyin.xml
diff options
context:
space:
mode:
Diffstat (limited to 'src/zope/i18n/locales/data/transforms/Latin-NumericPinyin.xml')
-rw-r--r--src/zope/i18n/locales/data/transforms/Latin-NumericPinyin.xml36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/zope/i18n/locales/data/transforms/Latin-NumericPinyin.xml b/src/zope/i18n/locales/data/transforms/Latin-NumericPinyin.xml
new file mode 100644
index 0000000..8b839f6
--- /dev/null
+++ b/src/zope/i18n/locales/data/transforms/Latin-NumericPinyin.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE supplementalData SYSTEM "http://www.unicode.org/cldr/dtd/1.5/ldmlSupplemental.dtd">
+<supplementalData>
+ <transforms>
+ <transform source="Latin" target="NumericPinyin" direction="both">
+ <comment># According to the pinyin definitions I've been able to find:</comment>
+ <comment># 'a', 'e' are the preferred bases</comment>
+ <comment># otherwise 'o'</comment>
+ <comment># otherwise last vowel</comment>
+ <comment># The trailing form of syllables are the following:</comment>
+ <comment># &quot;a&quot;, &quot;ai&quot;, &quot;ao&quot;, &quot;an&quot;, &quot;ang&quot;,</comment>
+ <comment># &quot;o&quot;, &quot;ou&quot;, &quot;ong&quot;,</comment>
+ <comment># &quot;e&quot;, &quot;ei&quot;, &quot;er&quot;, &quot;en&quot;, &quot;eng&quot;,</comment>
+ <comment># &quot;i&quot;, &quot;ia&quot;, &quot;iao&quot;, &quot;ie&quot;, &quot;iu&quot;, &quot;ian&quot;, &quot;in&quot;, &quot;iang&quot;, &quot;ing&quot;, &quot;iong&quot;,</comment>
+ <comment># &quot;u&quot;, &quot;ua&quot;, &quot;uo&quot;, &quot;uai&quot;, &quot;ui&quot;, &quot;uan&quot;, &quot;un&quot;, &quot;uang&quot;, &quot;ueng&quot;,</comment>
+ <comment># &quot;ü&quot;, &quot;üe&quot;, &quot;üan&quot;, &quot;ün&quot;</comment>
+ <comment># so the letters the tone will 'hop' are:</comment>
+ <tRule>::NFD (NFC);</tRule>
+ <tRule>$tone = [̄́̌̀̆] ;</tRule>
+ <comment># Move the tone to the end of a syllable, and convert to number</comment>
+ <tRule>e {($tone) r} → r &amp;tone-digit($1);</tRule>
+ <tRule>($tone) ( [i o n u {o n} {n g}]) → $2 &amp;tone-digit($1);</tRule>
+ <tRule>($tone) → &amp;tone-digit($1);</tRule>
+ <comment># The following backs up until it finds the right vowel, then deposits the tone</comment>
+ <tRule>$vowel = [aAeEiIoOuUüÜ {ü} {Ü} ];</tRule>
+ <tRule>$consonant = [[a-z A-Z] - [$vowel]];</tRule>
+ <tRule>$digit = [1-5];</tRule>
+ <tRule>$1 &amp;digit-tone($3) $2 ← ([aAeE]) ($vowel* $consonant*) ($digit);</tRule>
+ <tRule>$1 &amp;digit-tone($3) $2 ← ([oO]) ([$vowel-[aeAE]]* $consonant*) ($digit);</tRule>
+ <tRule>$1 &amp;digit-tone($3) $2 ← ($vowel) ($consonant*) ($digit);</tRule>
+ <tRule>&amp;digit-tone($1) ← [:letter:] {($digit)};</tRule>
+ <tRule>::NFC (NFD);</tRule>
+ </transform>
+ </transforms>
+</supplementalData>
+