64 name = member.rsplit(
'/', 1)[-1]
65 print(
'Extracting %s ...' % name)
67 shutil.move(member, name)
69 shutil.rmtree(member.split(
'/', 1)[0])
70 if pyversion[:1]
in [
'2']:
71 fc =
open(name,
'rb', encoding,
'ignore')
73 fc =
open(name,
'r', encoding=encoding, errors=
'ignore')
268 wordlist =
list(src_wordlist)
269 wordlist.sort(key=
lambda w: (len(w), w), reverse=
True)
271 word_reconv_table = {}
272 conv_table = char_conv_table.copy()
273 reconv_table = char_reconv_table.copy()
274 tomanyptn = re.compile(
'(?:%s)' %
'|'.join(src_tomany))
276 conv_table.update(word_conv_table)
277 reconv_table.update(word_reconv_table)
278 word = wordlist.pop()
279 new_word_len = word_len = len(word)
280 while new_word_len == word_len:
281 test_word =
translate(word, reconv_table)
283 if not reconv_table.get(new_word)
and \
284 (test_word != word
or
285 (tomanyptn.search(word)
and
286 word !=
translate(new_word, reconv_table))):
287 word_conv_table[word] = new_word
288 word_reconv_table[new_word] = word
290 word = wordlist.pop()
293 new_word_len = len(word)
294 return word_reconv_table
304 url =
'http://www.unicode.org/Public/%s/ucd/Unihan.zip' % UNIHAN_VER
305 han_dest =
'Unihan-%s.zip' % UNIHAN_VER
308 sfurlbase =
'http://%s.dl.sourceforge.net/sourceforge/' % SF_MIRROR
311 url = sfurlbase +
'scim/scim-tables-%s.tar.gz' % SCIM_TABLES_VER
312 tbe_dest =
'scim-tables-%s.tar.gz' % SCIM_TABLES_VER
316 url = sfurlbase +
'scim/scim-pinyin-%s.tar.gz' % SCIM_PINYIN_VER
317 pyn_dest =
'scim-pinyin-%s.tar.gz' % SCIM_PINYIN_VER
321 url = sfurlbase +
'libtabe/libtabe-%s.tgz' % LIBTABE_VER
322 lbt_dest =
'libtabe-%s.tgz' % LIBTABE_VER
330 s2t_1tomany.update((t[0], [f])
for (f, t)
in charManualTable(
'symme_supp.manual'))
333 if pyversion[:1]
in [
'2']:
334 t2s_1to1 = dict([(f, t[0])
for (f, t)
in t2s_1tomany.iteritems()])
335 s2t_1to1 = dict([(f, t[0])
for (f, t)
in s2t_1tomany.iteritems()])
337 t2s_1to1 = dict([(f, t[0])
for (f, t)
in t2s_1tomany.items()])
338 s2t_1to1 = dict([(f, t[0])
for (f, t)
in s2t_1tomany.items()])
344 t2s_1to1 =
removeRules(
'trad2simp_noconvert.manual', t2s_1to1)
345 s2t_1to1 =
removeRules(
'simp2trad_noconvert.manual', s2t_1to1)
348 t2s_1to1_supp = t2s_1to1.copy()
349 s2t_1to1_supp = s2t_1to1.copy()
350 t2s_1to1_supp.update(
customRules(
'trad2simp_supp_set.manual'))
351 s2t_1to1_supp.update(
customRules(
'simp2trad_supp_set.manual'))
355 s2t_1to1_supp, t2s_1to1_supp)
356 t2s_word2word_manual.update(
customRules(
'toSimp.manual'))
358 t2s_1to1_supp, s2t_1to1_supp)
359 s2t_word2word_manual.update(
customRules(
'toTrad.manual'))
371 s_wordlist =
applyExcludes(s_wordlist,
'simpphrases_exclude.manual')
372 t_wordlist =
applyExcludes(t_wordlist,
'tradphrases_exclude.manual')
374 s2t_supp = s2t_1to1_supp.copy()
375 s2t_supp.update(s2t_word2word_manual)
376 t2s_supp = t2s_1to1_supp.copy()
377 t2s_supp.update(t2s_word2word_manual)
381 s2t_1to1_supp, t2s_supp)
382 t2s_word2word.update(t2s_word2word_manual)
384 t2s_1to1_supp, s2t_supp)
385 s2t_word2word.update(s2t_word2word_manual)
389 if pyversion[:1]
in [
'2']:
390 t2s_1to1 = dict([(f, t)
for (f, t)
in t2s_1to1.iteritems()
if f != t])
392 t2s_1to1 = dict([(f, t)
for (f, t)
in t2s_1to1.items()
if f != t])
395 if pyversion[:1]
in [
'2']:
396 s2t_1to1 = dict([(f, t)
for (f, t)
in s2t_1to1.iteritems()
if f != t])
398 s2t_1to1 = dict([(f, t)
for (f, t)
in s2t_1to1.items()
if f != t])
410 * Simplified / Traditional Chinese conversion tables
412 * Automatically generated using code and data in maintenance/language/zhtable/
413 * Do not modify directly!
418namespace MediaWiki\Languages\Data;
421public static $zh2Hant = [\n'''
423 +
'\n];\n\npublic static $zh2Hans = [\n' \
425 +
'\n];\n\npublic static $zh2TW = [\n' \
427 +
'\n];\n\npublic static $zh2HK = [\n' \
429 +
'\n];\n\npublic static $zh2CN = [\n' \
433 if pyversion[:1]
in [
'2']:
434 f =
open(os.path.join(
'..',
'..',
'..',
'languages',
'data',
'ZhConversion.php'),
'wb', encoding=
'utf8')
436 f =
open(os.path.join(
'..',
'..',
'..',
'languages',
'data',
'ZhConversion.php'),
'w', buffering=4096, encoding=
'utf8')
437 print (
'Writing ZhConversion.php ... ')
442 print (
'Deleting temporary files ... ')
443 os.remove(
'EZ-Big.txt.in')
444 os.remove(
'phrase_lib.txt')
446 os.remove(
'Unihan_Variants.txt')
447 os.remove(
'Wubi.txt.in')
448 os.remove(
'Ziranma.txt.in')