User:ColorfulGalaxy/Programs
外观
Chart generator (current version)
import sys import os.path import pypinyin import xdi8string # all the characters spaced out translated into shidinn f=open("wikifile.txt","w",encoding="utf-8") characters=[chr(i) for i in range(0x4e00,0xa000)] plaintext=' '.join(chr(n) for n in range(0x4e00,0xa000)) ciphertext=xdi8string.output b1i45=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,(0),0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,44,39,42,22,23,38,26,41,0,0,0,0,0,0,0, 0,35,27,0,11,34,25,0,14,0,0,0,37,0,15,0, 0,0,0,0,40,0,43,0,0,36,0,0,0,0,0,0, 0,31,1,28,17,33,29,19,21,45,5,20,16,3,9,32, 2,6,13,12,18,30,24,4,7,8,10,0,0,0,0,0,0] b1i90000=[(((i-1)%9+1) * (10**((i-1)//9))if i!=0 else 0) for i in b1i45] def b1i45encode(word): return ' '.join((str(b1i45[ord(q)]) if len(str(b1i45[ord(q)]))>=2 else '0'+str(b1i45[ord(q)])) for q in word) def b1i90000sum(word): return sum([b1i90000[ord(q)] for q in word]) plain=plaintext.split() cipher=ciphertext.split() maxlength=0 maxlench=[] f.write("Do not simply rely on this chart to translate, as this chart did not handle [[talk:希顶日本语#注意多音字|homograph]] properly. The calculation may be incorrect. If so, please fix it.") f.write("{| class=\"wikitable sortable\"\n"); f.write("! Character !! Unicode decimal !! Stroke count !! han4 yu3 pin1 yin1 !! xdi8 aho !! [[b1i45密码|b1i45]] !! xdi8 aho letter count !! [[希顶解经|Numeral sum]] !! Stress pattern !! Notes\n") for p in range(len(plain)): if(plain[p]!=cipher[p]): f.write("|-\n"); f.write("| "+plain[p]+" || ") f.write(str(ord(plain[p]))) f.write(" || || ") f.write(pypinyin.pinyin(characters[p],style=pypinyin.Style.TONE3,neutral_tone_with_five=True)[0][0]) f.write(" || "+cipher[p]) f.write(" || "+b1i45encode(cipher[p])) f.write(" || "+str(len(cipher[p]))) f.write(" || "+str(b1i90000sum(cipher[p])) + "\n") if(maxlength<len(cipher[p])): maxlench=[p] maxlength=len(cipher[p]) elif(maxlength<=len(cipher[p])): maxlench+=[p] f.write("|}") print(maxlench,maxlength,len(maxlench)) f.close();