Module:fa-IPA/sandbox/testcases

From Wiktionary, the free dictionary
Jump to navigation Jump to search

13 of 76 tests failed. (refresh)

TextExpectedActualComments
test_classical_persian:
Passedسانسکریتsɑːns.kᵊ.ɾiːtsɑːns.kᵊ.ɾiːt
Passedخوشxʷaʃxʷaʃ
Passedخوابxʷɑːβxʷɑːβ
Passedابرنواخترʔa.βaɾ.naw.ʔax.ˈtaɾʔa.βaɾ.naw.ʔax.ˈtaɾ
Passedابراهیمʔiβ.ɾɑː.ˈhiːmʔiβ.ɾɑː.ˈhiːm
Passedامامʔi.ˈmɑːmʔi.ˈmɑːm
Passedپیشواpeːʃ.ˈwɑːpeːʃ.ˈwɑː
Passedنوnawnaw
Passedمستعمرهmus.taʔ.ma.ˈɾamus.taʔ.ma.ˈɾa
Passedآزادʔɑː.ˈzɑːðʔɑː.ˈzɑːð
Passedدادنdɑː.ˈðandɑː.ˈðan
Passedقولqawlqawl
Passedدولتdaw.latdaw.lat
Passedآخورʔɑː.xʷaɾʔɑː.xʷaɾ
Passedلغوlaɣwlaɣw
Passedمعتدلmuʔ.ta.ðilmuʔ.ta.ðil
Passedخویxʷajxʷaj
Passedخویدxʷeːðxʷeːð
TextExpectedActualComments
test_dari_persian:
Passedخوشxʊʃxʊʃ
Passedخوابxɑːbxɑːb
Passedخواهرxʷɑ́ː.ɦäɾxʷɑ́ː.ɦäɾ
Failedابرنواخترʔä.bäɾ.näw.ʔäx.t̪ʰǽɾʔä.bäɾ.näw.ʔäx.t̪ʰǽɾ
Failedابراهیمʔɪb.ɾɑː.ɦíːmʔɪb.ɾɑː.ɦíːm
Passedامامʔɪ.mɑ́ːmʔɪ.mɑ́ːm
Passedپیشواpʰeːʃ.wɑ́ːpʰeːʃ.wɑ́ː
Passedنوnäwnäw
Failedمستعمرهmʊs.t̪ʰäʔ.mä.ɾǽmʊs.t̪ʰäʔ.mä.ɾǽ
Passedآزادʔɑː.zɑ́ːd̪ʔɑː.zɑ́ːd̪
Passedقولqäwlqäwl
Passedدولتd̪äw.lät̪d̪äw.lät̪
Passedآخورʔɑː.xʊɾʔɑː.xʊɾ
Passedلغوläɣwläɣw
Passedگورɡäwɾɡäwɾ
Passedمعتدلmo̞ʔ.t̪ʰä.d̪ɪlmo̞ʔ.t̪ʰä.d̪ɪl
Passedخویxʊjxʊj
Passedخویدxeːd̪xeːd̪
TextExpectedActualComments
test_phonetic_iranian_persian:
Passedتوپt̪ʰuːpt̪ʰuːp
Passedدبستانd̪æ.bes.t̪ʰɒːnd̪æ.bes.t̪ʰɒːn
Passedکارkʰɒːɹkʰɒːɹ
Failedکمیcʰǽ.miːǽ.miː
Failedگیجɟiː.d̥͡ʒ̥ɟiːʒ̥
Passedگلɡ̥ol̥ɡ̥ol̥
Passedچندt͡ʃʰæn̪d̪̥t͡ʃʰæn̪d̪̥
Passedکتابچهcʰe.t̪ʰɒːb.t͡ʃʰecʰe.t̪ʰɒːb.t͡ʃʰe
Passedسگsæɟ̥sæɟ̥
Passedعشقʔeʃqʔeʃq
Passedقلبqælb̥qælb̥
Passedغزالqæ.zɒːl̥qæ.zɒːl̥
Passedگاوɡ̥ɒːvɡ̥ɒːv
Passedموسیقیmuː.siː.ʁiːmuː.siː.ʁiː
Passedنقطهnox.t̪ʰenox.t̪ʰe
Passedآهنگʔɒː.ɦæɲɟ̥ʔɒː.ɦæɲɟ̥
Passedسمفونیsæɱ.fo.niːsæɱ.fo.niː
Passedزنبورzæm.buːɹzæm.buːɹ
Passedانواعʔæɱ.vɒːʔʔæɱ.vɒːʔ
Passedانگورʔæŋ.ɡuːɹʔæŋ.ɡuːɹ
Passedعنقاʔæɴ.ɢɒːʔæɴ.ɢɒː
Failedاصلʔæsɬʔæs
TextExpectedActualComments
test_tajik:
Passedхуш (xuš)χuʃχuʃ
Passedхоб (xob)χɔbχɔb
Failedабарнавахтар (abarnavaxtar)ʔä.bäɾ.näw.ʔäχ.t̪ʰǽɾʔä.bäɾ.näw.ʔäχ.t̪ʰǽɾ
FailedИброҳим (Ibrohim)ʔib.ɾɔ.ɦímʔib.ɾɔ.ɦím
Passedимом (imom)ʔi.mɔ́mʔi.mɔ́m
Passedпешво (pešvo)pʰeʃ.vɔ́pʰeʃ.vɔ́
Passedнав (nav)näwnäw
Failedмустаъмара (mustaʾmara)mus.t̪ʰäʔ.mä.ɾǽmus.t̪ʰäʔ.mä.ɾǽ
Failedфoтеҳ (foteh)fɔ.t̪ʰéʱfɔ.t̪ʰéʱ
Failedдиҳад (dihad)d̪i.ɦǽd̪d̪i.ɦǽ
Failedфасеҳ (faseh)fä.séʱfä.séʱ
Failedвасеъ (vaseʾ)vä.séʔvä.séʔ
Passedохур (oxur)ʔɔ.χuɾʔɔ.χuɾ
Passedлағв (laġv)läʁwläʁw
Passedбиҳишт (bihišt)bi.ɦiʃt̪bi.ɦiʃt̪
Passedмӯътадил (müʾtadil)mɵʔ.t̪ʰä.d̪ilmɵʔ.t̪ʰä.d̪il
Passedхуй (xuy)χujχuj
Passedхед (xed)χed̪χed̪

local tests = require("Module:UnitTests")
local m_IPA = require("Module:fa-IPA/sandbox")

local sc_fa = require("Module:scripts").getByCode("fa-Arab")
local sc_tg = require("Module:scripts").getByCode("Cyrl")
local lang_fa = require("Module:languages").getByCode("fa")
local lang_tg = require("Module:languages").getByCode("tg")

local options = { display = tag_IPA, show_difference = true }

function link(term)
    return require("Module:links").full_link {
        term = term,
        lang = lang_fa,
        sc = sc_fa
    }
end

function link_tg(term)
    return require("Module:links").full_link {
        term = term,
        lang = lang_tg,
        sc = sc_tg
    }
end

local function tag_IPA(IPA)
	return '<span class="IPA">' .. IPA .. '</span>'
end

function tests:check_output_fa(term, romanisation, expected)
	self:equals(
		link(term),
		tag_IPA(m_IPA.fa_IPA(romanisation, false)),
		tag_IPA(expected),
		options
	)
end

function tests:check_output_fa_phonetic(term, romanisation, expected)
	self:equals(
		link(term),
		tag_IPA(m_IPA.fa_IPA(romanisation, true)),
		tag_IPA(expected),
		options
	)
end

function tests:check_output_fa_cls(term, romanisation, expected)
	self:equals(
		link(term),
		tag_IPA(m_IPA.fa_cls_IPA(romanisation)),
		tag_IPA(expected)
	)
end

function tests:check_output_tg(term, romanisation, expected)
	self:equals(
		link_tg(term),
		tag_IPA(m_IPA.tg_IPA(romanisation)),
		tag_IPA(expected),
		options
	)
end

function tests:check_output_prs(term, romanisation, expected)
	self:equals(
		link(term),
		tag_IPA(m_IPA.prs_IPA(romanisation)),
		tag_IPA(expected),
		options
	)
end

function tests:test_classical_persian()
	examples = {
		{ "سانسکریت", "sānskrīt", "sɑːns.kᵊ.ɾiːt"},-- complex syllabification test
		{ "خوش", "xwaš", "xʷaʃ"},
		{ "خواب", "xwāb", "xʷɑːβ"},
		{ "ابرنواختر", "abarnaw.ax`tar", "ʔa.βaɾ.naw.ʔax.ˈtaɾ"},
		{ "ابراهیم", "ibrā`hīm", "ʔiβ.ɾɑː.ˈhiːm"},
		{ "امام", "i`mām", "ʔi.ˈmɑːm"},
		{ "پیشوا", "pēš`vā", "peːʃ.ˈwɑː"},
		{ "نو", "naw", "naw"},
		{ "مستعمره", "musta'ma`ra", "mus.taʔ.ma.ˈɾa"},
		{ "آزاد", "ā`zād", "ʔɑː.ˈzɑːð"},
		{ "دادن", "dā`dan", "dɑː.ˈðan"},
		{ "قول", "qawl", "qawl"},
		{ "دولت", "dawlat", "daw.lat"},
		{ "آخور", "āxwar", "ʔɑː.xʷaɾ"},
		{ "لغو", "lağw", "laɣw"},
		{ "معتدل", "mu'tadil", "muʔ.ta.ðil"},
		{ "خوی", "xway", "xʷaj"},
		{ "خوید", "xwēd", "xʷeːð"},
	}
--[[	Copy the following to add more examples:
		{ "", "", ""},
]]
	
	tests:iterate(examples, "check_output_fa_cls")
end

function tests:test_dari_persian()
	examples = {
		{ "خوش", "xwaš", "xʊʃ"},
		{ "خواب", "xwāb", "xɑːb"},
		{ "خواهر", "`xʷā.har", "xʷɑ́ː.ɦäɾ"},
		{ "ابرنواختر", "abarnaw.ax`tar", "ʔä.bäɾ.näw.ʔäx.t̪ʰǽɾ"},
		{ "ابراهیم", "ibrā`hīm", "ʔɪb.ɾɑː.ɦíːm"},
		{ "امام", "i`mām", "ʔɪ.mɑ́ːm"},
		{ "پیشوا", "pēš`vā", "pʰeːʃ.wɑ́ː"},
		{ "نو", "naw", "näw"},
		{ "مستعمره", "musta'ma`ra", "mʊs.t̪ʰäʔ.mä.ɾǽ"},
		{ "آزاد", "ā`zād", "ʔɑː.zɑ́ːd̪"},
		{ "قول", "qawl", "qäwl"},
		{ "دولت", "dawlat", "d̪äw.lät̪"},
		{ "آخور", "āxwar", "ʔɑː.xʊɾ"},
		{ "لغو", "lağw", "läɣw"},
		{ "گور", "gawr", "ɡäwɾ"},
		{ "معتدل", "mu'tadil", "mo̞ʔ.t̪ʰä.d̪ɪl"},
		{ "خوی", "xway", "xʊj"},
		{ "خوید", "xwēd", "xeːd̪"},
	}
--[[	Copy the following to add more examples:
		{ "", "", ""},
]]
	
	tests:iterate(examples, "check_output_prs")
end

--[[	Copy the following to add more examples:
		{ "", "", ""},
]]



function tests:test_phonetic_iranian_persian()
	examples = {
		{ "توپ", "tōp", "t̪ʰuːp"},
		{ "دبستان", "dabis.tān", "d̪æ.bes.t̪ʰɒːn"},
		{ "کار", "kār", "kʰɒːɹ"},
		{ "کمی", "`kamē", "cʰǽ.miː"},
		{ "گیج", "gēj", "ɟiː.d̥͡ʒ̥"},
		{ "گل", "gul", "ɡ̥ol̥"},
		{ "چند", "čand", "t͡ʃʰæn̪d̪̥"},
		{ "کتابچه", "kitābča", "cʰe.t̪ʰɒːb.t͡ʃʰe"},
		{ "سگ", "sag", "sæɟ̥"},
		{ "عشق", "išq", "ʔeʃq"},
		{ "قلب", "qalb", "qælb̥"},
		{ "غزال", "ğazāl", "qæ.zɒːl̥"},
		{ "گاو", "gāw", "ɡ̥ɒːv"},
		{ "موسیقی", "mūsīqī", "muː.siː.ʁiː"},
		{ "نقطه", "nuqta", "nox.t̪ʰe"},
		{ "آهنگ", "āhang", "ʔɒː.ɦæɲɟ̥"},
		{ "سمفونی", "samfunī", "sæɱ.fo.niː"},
		{ "زنبور", "zanbūr", "zæm.buːɹ"},
		{ "انواع", "anwā'", "ʔæɱ.vɒːʔ"},
		{ "انگور", "angūr", "ʔæŋ.ɡuːɹ"},
		{ "عنقا", "anqā", "ʔæɴ.ɢɒː"},
		{ "اصل", "asl", "ʔæsɬ"},
	}
--[[	Copy the following to add more examples:
		{ "", "", ""},
]]
	
	tests:iterate(examples, "check_output_fa_phonetic")
end

function tests:test_tajik()
	examples = {
		{ "хуш", "xwaš", "χuʃ"},
		{ "хоб", "xwāb", "χɔb"},
		{ "абарнавахтар", "abarnaw.ax`tar", "ʔä.bäɾ.näw.ʔäχ.t̪ʰǽɾ"},
		{ "Иброҳим", "ibrā`hīm", "ʔib.ɾɔ.ɦím"},
		{ "имом", "i`mām", "ʔi.mɔ́m"},
		{ "пешво", "pēš`vā", "pʰeʃ.vɔ́"},
		{ "нав", "naw", "näw"},
		{ "мустаъмара", "musta'ma`ra", "mus.t̪ʰäʔ.mä.ɾǽ"},
        { "фoтеҳ", "fā`tih", "fɔ.t̪ʰéʱ"},
        { "диҳад", "di`had", "d̪i.ɦǽd̪"},
        { "фасеҳ", "fa`sīh", "fä.séʱ"},
        { "васеъ", "va`sī\'", "vä.séʔ"},
		{ "охур", "āxwar", "ʔɔ.χuɾ"},
		{ "лағв", "lağw", "läʁw"},
		{ "биҳишт", "bihišt", "bi.ɦiʃt̪"},
		{ "мӯътадил", "mu'tadil", "mɵʔ.t̪ʰä.d̪il"},
		{ "хуй", "xway", "χuj"},
		{ "хед", "xwēd", "χed̪"},
	}
--[[	Copy the following to add more examples:
		{ "", "", ""},
]]
	
	tests:iterate(examples, "check_output_tg")
end

return tests