Per WT:BOT, can you post the code you'll be using, please?—msh210℠ (talk) 15:41, 20 July 2012 (UTC)
This is the code used to transcribe Malagasy words to phonological IPA pronunciation. It is part of a greater script so I've put only needed functions. For the
# -*- coding: utf-8 -*-
import wikipedia, catlib, pagegenerators
import wikipedia as pywikibot
def put_mg_on_en():
uselang = 'mg'
cat = pagegenerators.CategorizedPageGenerator(catlib.Category(pywikibot.getSite('en', 'wiktionary'), "Malagasy nouns"))
for page in cat:
c = page.get()
if c.find('{{IPA|')!=-1:
print 'efa misy fanononana!'
continue
c = c.replace('==Malagasy==','==Malagasy==\n===Pronunciation===\n{{IPA|/%s/|lang=mg}}'%getpron(page.title()))
page.put(c, "]) (putting word IPA pronunciation")
def getpron(page):
page = page.lower()
pron_dict = {
u'b' : u'b',
u'c' : u's',
u'd' : u'd',
u'e' : u'e',
u'f' : u'f',
u'à' : u'ˈa',
u'g' : u'g',
u'h' : u'ʔ',
u'i' : u'i',
u'j' : u'd͡z',
u'k' : u'k',
u'l' : u'l',
u'm' : u'm',
u'n' : u'n',
u'o' : u'u',
u'p' : u'p',
u'q' : u'k',
u'r' : u'ɾ',
u's' : u's',
u't' : u't',
u'u' : u'u',
u'v' : u'v',
u'w' : u'w',
u'x' : u'kz',
u'ñ' : u'ɳ',
u'y' : u'ʲ',
u'z' : u'z',
u' ' : u' ',
u'-' : u'',
u"'" : u'',
}
prononciation = ''
cont = 0
nb_car_page = len(page)
for let in page:
try:
prononciation += let.replace(let, pron_dict)
cont += 1
except KeyError:
prononciation += let
cont += 1
prononciation = prononciation.replace(u'inku', u'iŋkʲu')
prononciation = prononciation.replace(u'inka', u'iŋ͡kʲa')
prononciation = prononciation.replace(u'ingu', u'iŋ͡gʲu')
prononciation = prononciation.replace(u'inga', u'iŋ͡gʲa')
prononciation = prononciation.replace(u'iku', u'ikʲu')
prononciation = prononciation.replace(u'ts', u't͡s')
prononciation = prononciation.replace(u'nt', u'n͡t')
prononciation = prononciation.replace(u'ndɾ', u'nɖ͡ʐ')
prononciation = prononciation.replace(u'ika', u'ikʲa')
prononciation = prononciation.replace(u'dɾ', u'ɖ͡ʐ')
prononciation = prononciation.replace(u'tɾ', u't͡ʂ')
prononciation = prononciation.replace(u'nk', u'ŋ͡k')
prononciation = prononciation.replace(u'ng', u'ŋ͡g')
prononciation = prononciation.replace(u'mb', u'm͡b')
prononciation = prononciation.replace(u'mp', u'm͡p')
if prononciation == u'a':
prononciation = prononciation + u'ạ'
if prononciation == u'u':
prononciation = prononciation + u'ʷ'
if prononciation == u'y':
prononciation = prononciation + u'ʲ'
return prononciation
if __name__ == '__main__':
try:
put_mg_on_en()
finally
wikipedia.stopme()
--Jagwar (talk) 17:10, 20 July 2012 (UTC)
{{IPA|/%s/|lang=mg}}
instead of {{IPA|/%s/}}<!--Malagasy-->
?—msh210℠ (talk) 17:22, 20 July 2012 (UTC)
I see from glancing on your talk page that there were previous concerns about accuracy, including many bad page titles being created. Can you explain this problem, and how you fixed it (if you fixed it)? --Μετάknowledgediscuss/deeds 16:29, 20 July 2012 (UTC)
I have re-supported, pending future discoveries. --Μετάknowledgediscuss/deeds 23:02, 20 July 2012 (UTC)
Can I also have some explanations about the fact that someone is pointing out my changes on my homewiki when I am asking for bot status on this wiki? --Jagwar (talk) 21:27, 20 July 2012 (UTC)