Module:de-IPA/testcases

local tests = require('Module:UnitTests') local m_de_IPA = require('Module:de-IPA') local m_links = require('Module:links')

local lang = require('Module:languages').getByCode('de')

local function tag_IPA(IPA) return ' ' .. IPA .. ' ' end

function tests:check_pron(De, IPA, respelling, orig) self:equals(		m_links.full_link({term = De, lang = lang}, nil, true) ..			(respelling and (" (respelled " .. respelling .. ")") or "") ..			(orig and ", orig=" .. orig or ""),		m_de_IPA.IPA(respelling or De, orig) or "NULL", IPA,		{ nowiki=true, display = tag_IPA }	) end

-- Entries here usually look like --   self:check_pron("GERMAN", "PRONUNCIATION") -- -- but can also be --   self:check_pron("GERMAN", "PRONUNCIATION", "RESPELLED-GERMAN") -- -- e.g. --   self:check_pron("Erde", "ˈeːɐ̯də", "Ehrde") --   self:check_pron("Reichstag", "ˈraɪ̯çstaːk", "Reichs/tag")

-- A fourth argument can be specified to indicate Romance origin, which --     causes certain changes like ultimate or penultimate stress and --     interpreting v as /v/ instead of /f/: --   self:check_pron("GERMAN", "PRONUNCIATION", nil, "rom") --   self:check_pron("GERMAN", "PRONUNCIATION", "RESPELLED-GERMAN", "rom") -- -- e.g. --   self:check_pron("Phonem", "foˈneːm", nil, "rom") --   self:check_pron("Enklave", "ɛnˈklaːʋə", nil, "rom") -- --Annotation: I'm assuming the output to be broad, so this uses ⟨r⟩, while /ʁ/ is the commonest actual pronunciation.

function tests:test_pron local examples = { -- A:		{ "Vater", "ˈfaːtɐ" }, { "Anna", "ˈana" }, { "Saal", "zaːl" }, { "Qual", "kʋaːl" }, { "lokal", "loˈkaːl", nil, "rom" }, { "Sarg", "zaɐ̯k" }, { "hart", "haɐ̯t" }, { "Waise", "ˈʋaɪ̯zə" }, -- Ä { "Schlächter", "ˈʃlɛçtɐ" }, { "gäbe", "ˈgɛːbə" }, { "Käse", "ˈkɛːzə" }, -- Possibly must be /eː/. Native status of ɛː is debated. I think most professional readers speak as written, but my understanding is that the spelling does not reflect any actual spoken language consistently. /ɛː/ is so absent here that my brain parses [ɛː] as [eː] -- AH 		{ "Auswahl", "ˈaʊ̯sʋaːl" }, { "Zahlen", "ˈtsaːlən" }, -- ÄH { "wählen", "ˈʋɛːlən" }, -- Could be /veːlən/, see Käse -- AU: { "brauchen", "ˈbraʊ̯xən" }, --CH { "gleichen", "ˈglaɪ̯çən" }, { "Archen", "ˈaɐ̯çən" }, { "Aachen", "ˈaːχən" }, { "solch", "zɔlç" }, { "Wacht", "ʋaχt" }, { "doch", "dɔχ" }, -- D		{ "Stadt", "ʃtat" }, -- DSCH { "Dschungel", "ˈdʒʊŋəl" }, -- E:		{ "lesen", "ˈleːzən" }, { "lecker", "ˈlɛkɐ" }, { "Erde", "ˈeːɐ̯də", "Ehrde" }, { "werden", "ˈʋɛɐ̯dən" }, { "abendlich", "ˈabəntlɪç" }, -- EI: { "Reichstag", "ˈraɪ̯çstaːk", "Reichs/tag" }, { "Eiche", "ˈaɪ̯çə" }, -- ER: { "oder", "ˈoːdɐ" }, -- H		{ "Hund", "hʊnt" }, { "sehen", "zeːn" }, -- You often see /zeːən/, which is hypercorrect spelling-pron., might be standard anyway. { "nah", "naː" }, -- I		{ "Nische", "ˈniːʃə", "Niesche", "rom" }, -- Borrowing { "mische", "ˈmɪʃə" }, -- native -- IE: { "spielen", "ˈʃpiːlən" }, { "Tier", "tiːɐ̯" }, -- This pronunciation is pretty wrong and would be understood as 'Tia', but I think it's the expected transcription. The actual level of the r-vowel raises with the preceding vowel. -- Ö: { "Österreich", "ˈøːstɐraɪ̯ç", "Öhster/reich" }, { "köstlich", "ˈkœstlɪç" }, { "öffnen", "ˈœfnən" }, { "höre", "ˈhøːrə" }, { "hört", "hœɐ̯t" }, { "Plörre", "ˈplœrə" }, -- QU: { "Quatsch", "kʋatʃ" }, -- Must be [kfatʃ] if /v/ is used instead of /ʋ/ -- S/ß: { "aßen", "ˈaːsən" }, { "Haus", "haʊ̯s" }, { "Hause", "ˈhaʊ̯zə" }, { "lasen", "ˈlaːzən" }, { "massig", "ˈmasɪç" }, -- SCH: { "Tisch", "tɪʃ" }, { "scheußlich", "ˈʃɔʏ̯slɪç" }, { "Asche", "ˈaʃə" }, -- TSCH: { "Quatsch", "kʋatʃ" }, -- U		{ "Buch", "buːx" }, { "Kusses", "ˈkʊsəs" }, { "Furcht", "fʊɐ̯çt" }, -- UH: { "Uhr", "uːɐ̯" }, -- Ü { "Bücher", "ˈbyːçɐ" }, { "Brücke", "ˈbrʏkə" }, { "Tür", "tyːɐ̯" }, -- ÜH -- V		{ "Vogel", "ˈfoːgəl" }, { "Vase", "ˈʋaːzə", nil, "rom" }, -- Borrowing, should this have [v]? { "administrativ", "ˌatmɪnɪstraˈtif", nil, "rom" }, -- Might have a long /i/; I can't tell since northern speech has no length distinction { "selektiv", "zeˌlɛkˈtif", nil, "rom" }, -- W		{ "Möwe", "ˈmøːʋə" }, { "was", "ʋas" }, -- Affixes (Stress) { "geglichen", "gəˈglɪçən" }, { "angeglichen", "ˈangəˌglɪçən" }, { "aufgeben", "ˈaʊ̯fˌɡeːbən" }, -- should be smart enough not to interpret -ge- here as a prefix (because followed by -en		{ "aufgegeben", "ˈaʊ̯fɡəˌɡeːbən" },		{ "Mächtigkeit", "ˈmɛçtɪçˌkaɪ̯t" },		-- Borrowed words with unexpected stress:		{ "eventuell", "eˈʋɛntuˌɛll", "evéntuèll", "rom" }, -- Borrowing, should this have [v]?		{ "Enklave", "ɛnˈklaːʋə", nil, "rom" }, -- Borrowing, should this have [v]?		{ "Phonem", "foˈneːm", nil, "rom" },		{ "Chemie", "çeˈmiː", nil, "rom" },		{ "Information", "ˌɪnfoɐ̯maˈtsi̯oːn", nil, "rom" }, -- Notice how this Roman word uses /ɪ/		{ "Platin", "ˈplaːtin", "Plátin", "rom" }, -- And this one doesn't.		{ "Qualität", "ˌkʋaliˈtɛːt", nil, "rom" }, -- See Käse		{ "Rasur", "raˈzuːɐ̯", nil, "rom" },		{ "rasieren", "raˈziːrən", nil, "rom" },		{ "programmieren", "ˌprograˈmiːrən", nil, "rom" },		-- Slash separating compounds:		{ "Buchstabe", "ˈbuːxʃtaːbə", "Buch/stabe" }, { "Urheberrecht", "ˈuːɐ̯heːbɐˌrɛçt", "Ur/heber/rècht" }, { "Standartenführer", "ʃtanˈdartənˌfyːrɐ", "Standárten/führer" }, { "Aufenthaltsgenehmigung", "ˈaʊ̯fɛnthaltsɡəˌneːmiɡʊŋ", "Aufenthalts/genehmigung" }, -- Irregular borrowings: { "doof", "doːf" }, { "doofes", "ˈdoːʋəs", "dooves" }, -- Borrowing, should this have [v]? }	self:iterate(examples, "check_pron") end

return tests

-- For Vim, so we get 4-space tabs -- vim: set ts=4 sw=4 noet: