]> Git — Sourcephile - julm/worksheets.git/blob - src/Language/Chinese/Pinyin.hs
wip
[julm/worksheets.git] / src / Language / Chinese / Pinyin.hs
1 -- | Taubert, S. (2025). pinyin-to-ipa (Version 1.0.0) [Computer software]. https://doi.org/10.5281/zenodo.15229718
2 module Language.Chinese.Pinyin where
3
4 import Data.Map.Strict qualified as Map
5
6 import Worksheets.Utils.Prelude
7
8 initialMapping :: Map ShortText [ShortText]
9 initialMapping =
10 [ "b" := ["p"]
11 , "c" := ["tsʰ"] -- tsʰ
12 , "ch" := ["ʈʂʰ"] -- tʂʰ
13 , "d" := ["t"]
14 , "f" := ["f"]
15 , "g" := ["k"]
16 , "h" := ["x", "h"]
17 , "j" := ["tɕ"]
18 , "k" := ["kʰ"]
19 , "l" := ["l"]
20 , "m" := ["m"]
21 , "n" := ["n"]
22 , "p" := ["pʰ"]
23 , "q" := ["tɕʰ"]
24 , "r" := ["ɻ", "ʐ"]
25 , "s" := ["s"]
26 , "sh" := ["ʂ"]
27 , "t" := ["tʰ"]
28 , "x" := ["ɕ"]
29 , "z" := ["ts"]
30 , "zh" := ["ʈʂ"] -- tʂ
31 -- w and y only occur in non-strict initials
32 -- "w" := ["w"]
33 -- "y" := ["j",), ("ɥ"]
34 ]
35 & mapFromListCheckingDuplicates
36
37 initials = initialMapping & Map.keys
38
39 -- | Note: Syllabic consonants may also arise as a result of weak syllable reduction.
40 -- Syllabic nasal consonants are also heard in certain interjections;
41 -- pronunciations of such words include [m], [n], [ŋ], [hm], [hŋ].
42 syllabicConsonantMappings :: Map ShortText [ShortText]
43 syllabicConsonantMappings =
44 [ "hm" := ["h", "m0"]
45 , "hng" := ["h", "ŋ0"]
46 , "m" := ["m0"]
47 , "n" := ["n0"]
48 , "ng" := ["ŋ0"]
49 ]
50 & mapFromListCheckingDuplicates
51
52 syllabicConsonants = syllabicConsonantMappings & Map.keys