Module:ang-pron/testcases
Appearance
- The following documentation is located at Module:ang-pron/testcases/documentation. [edit] Categories were auto-generated by Module:module categorization. [edit]
- Useful links: root page • root page’s subpages • links • transclusions • tested module • sandbox
All tests passed. (refresh)
Text | Expected | Actual | |
---|---|---|---|
habban, pos=verb | /ˈxɑb.bɑn/ | /ˈxɑb.bɑn/ | |
ēaġe | /ˈæ͜ɑː.je/ | /ˈæ͜ɑː.je/ | |
senġan, pos=verb | /ˈsen.jɑn/ | /ˈsen.jɑn/ | |
eċġ, pos=noun | /ejj/ | /ejj/ | |
ālīefan | /ɑːˈli͜yː.fɑn/ | /ɑːˈli͜yː.fɑn/ | |
oferdōn | /ˌo.ferˈdoːn/ | /ˌo.ferˈdoːn/ | |
æx, pos=noun | /æks/ | /æks/ | |
beforan | /beˈfo.rɑn/ | /beˈfo.rɑn/ | |
āsāƿan, pos=verb | /ɑːˈsɑː.wɑn/ | /ɑːˈsɑː.wɑn/ | |
ġeong (respelled ġung) | /junɡ/ | /junɡ/ | |
sċeolde (respelled sċolde) | /ˈʃol.de/ | /ˈʃol.de/ | |
sċeadu (respelled sċadu), pos=noun | /ˈʃɑ.du/ | /ˈʃɑ.du/ | |
ġeolu | /ˈje͜o.lu/ | /ˈje͜o.lu/ | |
sellan, pos=verb | /ˈsel.lɑn/ | /ˈsel.lɑn/ | |
feallan, pos=verb | /ˈfæ͜ɑl.lɑn/ | /ˈfæ͜ɑl.lɑn/ | |
wasċan | /ˈwɑʃ.ʃɑn/ | /ˈwɑʃ.ʃɑn/ | |
husċ | /xuʃ/ | /xuʃ/ | |
foresċēawung | /fo.reˈʃæ͜ɑː.wunɡ/ | /fo.reˈʃæ͜ɑː.wunɡ/ | |
ġeddung | /ˈjed.dunɡ/ | /ˈjed.dunɡ/ | |
unġewintred (respelled un-ġewintred) | /ˈun.jeˌwin.tred/ | /ˈun.jeˌwin.tred/ | |
fleaxen | /ˈflæ͜ɑk.sen/ | /ˈflæ͜ɑk.sen/ | |
edcwician (respelled ed<cwician) | /edˈkwi.ki.ɑn/ | /edˈkwi.ki.ɑn/ | |
ān | /ɑːn/ | /ɑːn/ | |
ān and twēntiġ | /ɑːn ɑnd ˈtweːn.tij/ | /ɑːn ɑnd ˈtweːn.tij/ | |
ā́n and twēntiġ | /ˈɑːn ɑnd ˈtweːn.tij/ | /ˈɑːn ɑnd ˈtweːn.tij/ | |
bēacniendlīċ (respelled bēacni.endlīċ) | /ˈbæ͜ɑːk.ni.end.liːt͡ʃ/ | /ˈbæ͜ɑːk.ni.end.liːt͡ʃ/ | |
bedul (respelled bédul) | /ˈbe.dul/ | /ˈbe.dul/ | |
beorhtost | /ˈbe͜orx.tost/ | /ˈbe͜orx.tost/ | |
ġeāgniendlīċ (respelled ġe<āg.ni.endlīċ) | /jeˈɑːɡ.ni.end.liːt͡ʃ/ | /jeˈɑːɡ.ni.end.liːt͡ʃ/ | |
-estre | /es.tre/ | /es.tre/ | |
aldorlēas | /ˈɑl.dorˌlæ͜ɑːs/ | /ˈɑl.dorˌlæ͜ɑːs/ | |
unclǣne | /ˈunˌklæː.ne/ | /ˈunˌklæː.ne/ | |
undōn | /unˈdoːn/ | /unˈdoːn/ | |
unġesewenlīċ | /ˈun.jeˌse.wen.liːt͡ʃ/ | /ˈun.jeˌse.wen.liːt͡ʃ/ |
Text | Expected | Actual | |
---|---|---|---|
habban | [ˈhɑb.bɑn] | [ˈhɑb.bɑn] | |
senġan, pos=verb | [ˈsen.d͡ʒɑn] | [ˈsen.d͡ʒɑn] | |
senċġan | [ˈsen.d͡ʒɑn] | [ˈsen.d͡ʒɑn] | |
eċġ, pos=noun | [ed͡ʒ] | [ed͡ʒ] | |
ālīefan | [ɑːˈli͜yː.vɑn] | [ɑːˈli͜yː.vɑn] | |
oferdōn | [ˌo.verˈdoːn] | [ˌo.verˈdoːn] | |
æx, pos=noun | [æks] | [æks] | |
beforan | [beˈfo.rɑn] | [beˈfo.rɑn] | |
ġeong (respelled ġung) | [juŋɡ] | [juŋɡ] | |
sċeolde (respelled sċolde) | [ˈʃoɫ.de] | [ˈʃoɫ.de] | |
sellan, pos=verb | [ˈseɫ.ɫɑn] | [ˈseɫ.ɫɑn] | |
feallan, pos=verb | [ˈfæ͜ɑɫ.ɫɑn] | [ˈfæ͜ɑɫ.ɫɑn] | |
hēafdes, pos=noun | [ˈhæ͜ɑːv.des] | [ˈhæ͜ɑːv.des] | |
siġehrēþiġ (respelled siġe-hrēþiġ) | [ˈsi.jeˌr̥eː.ðij] | [ˈsi.jeˌr̥eː.ðij] | |
swīþferhþ (respelled swī́þfèrhþ) | [ˈswiːθˌferˠxθ] | [ˈswiːθˌferˠxθ] | |
miht, pos=noun | [miçt] | [miçt] | |
beorht | [be͜orˠxt] | [be͜orˠxt] | |
nēah | [næ͜ɑːx] | [næ͜ɑːx] | |
rihte | [ˈriç.te] | [ˈriç.te] | |
feohtan, pos=verb | [ˈfe͜ox.tɑn] | [ˈfe͜ox.tɑn] | |
feorr | [fe͜orˠ] | [fe͜orˠ] | |
fæþm | [fæðm] | [fæðm] | |
wīnġeard (respelled wīn-ġeard), pos=noun | [ˈwiːnˌjæ͜ɑrˠd] | [ˈwiːnˌjæ͜ɑrˠd] | |
wynsum | [ˈwyn.sum] | [ˈwyn.sum] | |
ċearfull | [ˈt͡ʃæ͜ɑr.fuɫ] | [ˈt͡ʃæ͜ɑr.fuɫ] | |
wyrgþu | [ˈwyrˠɣ.θu] | [ˈwyrˠɣ.θu] | |
ālīefednes, pos=verb | [ɑːˈli͜yː.ved.nes] | [ɑːˈli͜yː.ved.nes] | |
pohha | [ˈpox.xɑ] | [ˈpox.xɑ] | |
adesa | [ˈɑ.de.sɑ] | [ˈɑ.de.sɑ] | |
hlǣfdīġe (respelled hlǣf-dīġe) | [ˈl̥æːvˌdiː.je] | [ˈl̥æːvˌdiː.je] | |
ǣttren | [ˈæːt.tren] | [ˈæːt.tren] | |
sċeacga (respelled sċacga) | [ˈʃɑɡ.ɡɑ] | [ˈʃɑɡ.ɡɑ] | |
drūsian | [ˈdruː.zi.ɑn] | [ˈdruː.zi.ɑn] | |
hālsian | [ˈhɑːɫ.si.ɑn] | [ˈhɑːɫ.si.ɑn] | |
clǣnsian (respelled clǣn[z]ian) | [ˈklæːn.zi.ɑn] | [ˈklæːn.zi.ɑn] |
local tests = require "Module:UnitTests"
local m_IPA = require "Module:ang-pron"
local lang = require("Module:languages").getByCode("ang")
local function tag_IPA(phonemic)
return function (IPA)
if phonemic then
IPA = '/' .. IPA .. '/'
else
IPA = '[' .. IPA .. ']'
end
return '<span class="IPA">' .. IPA .. '</span>'
end
end
local function remove_diacritics(term)
term = mw.ustring.toNFD(term)
return term:gsub("\204[\128-\191]", "") -- codepoints U+300-33F
end
local function link(term)
return '<span class="Latn" lang="ang">[[' .. remove_diacritics(term) .. "#Old English|" .. term
.. ']]</span>'
end
local phonemic_options = { display = tag_IPA(true), show_difference = true }
function tests:check_phonemic(spelling, respelling, expected, transcription_options)
local pos = transcription_options.pos
self:equals(link(spelling) ..
(spelling ~= respelling and (" (respelled " .. require("Module:script_utilities").tag_text(respelling, lang) .. ")" ) or "") ..
(pos and ", pos=" .. pos or ""),
m_IPA.phonemic(respelling, pos), expected, phonemic_options)
end
local phonetic_options = { display = tag_IPA(false), show_difference = true }
function tests:check_phonetic(spelling, respelling, expected, transcription_options)
local pos = transcription_options.pos
self:equals(link(spelling) ..
(spelling ~= respelling and (" (respelled " .. require("Module:script_utilities").tag_text(respelling, lang) .. ")" ) or "") ..
(pos and ", pos=" .. pos or ""),
m_IPA.phonetic(respelling, pos), expected, phonetic_options)
end
-- Tab-separated words used in [[Module:ang-pron/testcases]]:
-- word, phonemic transcription, part of speech.
-- The word can be in the form `spelling:respelling` for words needing respelling.
-- The part of speech and preceding tab can be omitted.
local phonemic_examples = [[
habban ˈxɑb.bɑn verb
ēaġe ˈæ͜ɑː.je
senġan ˈsen.jɑn verb
eċġ ejj noun
ālīefan ɑːˈli͜yː.fɑn
oferdōn ˌo.ferˈdoːn
æx æks noun
beforan beˈfo.rɑn
āsāƿan ɑːˈsɑː.wɑn verb
ġeong:ġung junɡ
sċeolde:sċolde ˈʃol.de
sċeadu:sċadu ˈʃɑ.du noun
ġeolu ˈje͜o.lu
sellan ˈsel.lɑn verb
feallan ˈfæ͜ɑl.lɑn verb
wasċan ˈwɑʃ.ʃɑn -- In some existing transcriptions, gemination of /ʃ/ is only phonetic.
husċ xuʃ
foresċēawung fo.reˈʃæ͜ɑː.wunɡ
ġeddung ˈjed.dunɡ
unġewintred:un-ġewintred ˈun.jeˌwin.tred
fleaxen ˈflæ͜ɑk.sen
edcwician:ed<cwician edˈkwi.ki.ɑn
ān ɑːn
ān and twēntiġ ɑːn ɑnd ˈtweːn.tij
ā́n and twēntiġ ˈɑːn ɑnd ˈtweːn.tij
bēacniendlīċ:bēacni.endlīċ ˈbæ͜ɑːk.ni.end.liːt͡ʃ
bedul:bédul ˈbe.dul
beorhtost ˈbe͜orx.tost
ġeāgniendlīċ:ġe<āg.ni.endlīċ jeˈɑːɡ.ni.end.liːt͡ʃ
-estre es.tre
aldorlēas ˈɑl.dorˌlæ͜ɑːs
unclǣne ˈunˌklæː.ne -- un- before nouns and adjectives is stressed
undōn unˈdoːn -- un- before verbs is unstressed
unġesewenlīċ ˈun.jeˌse.wen.liːt͡ʃ -- un- before "verbals" is stressed
]]
-- Same as above, but for phonetic (not phonemic) transcription.
local phonetic_examples = [[
habban ˈhɑb.bɑn
senġan ˈsen.d͡ʒɑn verb
senċġan ˈsen.d͡ʒɑn
eċġ ed͡ʒ noun
ālīefan ɑːˈli͜yː.vɑn
oferdōn ˌo.verˈdoːn
æx æks noun
beforan beˈfo.rɑn
ġeong:ġung juŋɡ
sċeolde:sċolde ˈʃoɫ.de
sellan ˈseɫ.ɫɑn verb -- Should maybe have clear l (ˈsel.lɑn), because e is not diphthongized to eo.
feallan ˈfæ͜ɑɫ.ɫɑn verb
hēafdes ˈhæ͜ɑːv.des noun
siġehrēþiġ:siġe-hrēþiġ ˈsi.jeˌr̥eː.ðij
swīþferhþ:swī́þfèrhþ ˈswiːθˌferˠxθ
miht miçt noun
beorht be͜orˠxt
nēah næ͜ɑːx
rihte ˈriç.te
feohtan ˈfe͜ox.tɑn verb
feorr fe͜orˠ
fæþm fæðm
wīnġeard:wīn-ġeard ˈwiːnˌjæ͜ɑrˠd noun
wynsum ˈwyn.sum
ċearfull ˈt͡ʃæ͜ɑr.fuɫ
wyrgþu ˈwyrˠɣ.θu
ālīefednes ɑːˈli͜yː.ved.nes verb
pohha ˈpox.xɑ
adesa ˈɑ.de.sɑ
hlǣfdīġe:hlǣf-dīġe ˈl̥æːvˌdiː.je
ǣttren ˈæːt.tren
sċeacga:sċacga ˈʃɑɡ.ɡɑ
drūsian ˈdruː.zi.ɑn --s would be voiced here because the word is from *drūsijaną
hālsian ˈhɑːɫ.si.ɑn --s thought to be voiceless here because the word is contracted (from PG hailisōną)
clǣnsian:clǣn[z]ian ˈklæːn.zi.ɑn --exception with voicing despite contraction
]]
local function parse(examples)
local parsed_examples = {}
for line in examples:gsub("%s*%-%-[^\n]*", ""):gmatch "[^\n]+" do
local word, phonemic, POS = line:match "^([^\t]+)\t([^\t]+)\t?(.*)"
local spelling, respelling = word:match "^(.*):(.*)$"
spelling = spelling or word
respelling = respelling or word
if POS == "" then
POS = nil
end
table.insert(parsed_examples, { spelling, respelling, phonemic, { pos = POS }})
end
return parsed_examples
end
function tests:test_phonemic()
self:iterate(parse(phonemic_examples), "check_phonemic")
end
function tests:test_phonetic()
self:iterate(parse(phonetic_examples), "check_phonetic")
end
return tests