-- | Taubert, S. (2025). pinyin-to-ipa (Version 1.0.0) [Computer software]. https://doi.org/10.5281/zenodo.15229718 module Language.Chinese.Pinyin where import Data.Map.Strict qualified as Map import Worksheets.Utils.Prelude initialMapping :: Map ShortText [ShortText] initialMapping = [ "b" := ["p"] , "c" := ["tsʰ"] -- tsʰ , "ch" := ["ʈʂʰ"] -- tʂʰ , "d" := ["t"] , "f" := ["f"] , "g" := ["k"] , "h" := ["x", "h"] , "j" := ["tɕ"] , "k" := ["kʰ"] , "l" := ["l"] , "m" := ["m"] , "n" := ["n"] , "p" := ["pʰ"] , "q" := ["tɕʰ"] , "r" := ["ɻ", "ʐ"] , "s" := ["s"] , "sh" := ["ʂ"] , "t" := ["tʰ"] , "x" := ["ɕ"] , "z" := ["ts"] , "zh" := ["ʈʂ"] -- tʂ -- w and y only occur in non-strict initials -- "w" := ["w"] -- "y" := ["j",), ("ɥ"] ] & mapFromListCheckingDuplicates initials = initialMapping & Map.keys -- | Note: Syllabic consonants may also arise as a result of weak syllable reduction. -- Syllabic nasal consonants are also heard in certain interjections; -- pronunciations of such words include [m], [n], [ŋ], [hm], [hŋ]. syllabicConsonantMappings :: Map ShortText [ShortText] syllabicConsonantMappings = [ "hm" := ["h", "m0"] , "hng" := ["h", "ŋ0"] , "m" := ["m0"] , "n" := ["n0"] , "ng" := ["ŋ0"] ] & mapFromListCheckingDuplicates syllabicConsonants = syllabicConsonantMappings & Map.keys