用户:CrowleyBot/task/15
from prelude import *
def comp(s):
return zhc.convert(s, 'zh-tw')
def process():
zpg = zh.Pages[pn[i]]
txt = zpg.text()
focuscat = ['名词', '专有名词', '阴性名词', '阳性名词']
focuscat = ['俄语' + x for x in focuscat]
focuscat += list(map(comp, focuscat))
r = r'(\n*)' + r'\[\[(Category|category|分类|分類):(' + '|'.join(focuscat) + r')\]\]' + r'(\n*)'
def f(m):
if m.group(1) + m.group(4):
return '\n'
else:
return ''
(txt, _cnt) = re.subn(r, f, txt)
if _cnt:
tryedit(zpg, txt, summary=defaultsummary)