-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathkanji.py
executable file
·31 lines (29 loc) · 4.39 KB
/
kanji.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
kanjistr = '醜丑専专業业東东糸丝両两厳严喪丧個个豊丰臨临為为麗丽挙举義义楽乐習习郷乡書书買买雲云亜亚産产畝亩親亲億亿僕仆従从倉仓儀仪価价衆众優优傘伞偉伟伝传傷伤倫伦偽伪仏佛偵侦側侧倹俭債债値值傾倾仮假償偿児儿関关興兴養养獣兽冊册軍军農农塚冢氷冰沖冲決决況况凍冻準准涼凉減减幾几撃击則则剛刚創创別别剤剂剣剑劇剧勧劝務务動动労劳勢势勲勋昇升華华協协単单売卖衛卫巻卷歴历暦历圧压県县発发変变畳叠隻只葉叶嘆叹後后嚇吓聴听'
kanjistr += '啓启呉吴員员詠咏響响喚唤噴喷団团園园囲围図图円圆聖圣場场壊坏塊块堅坚壇坛墳坟墜坠塁垒墾垦増增殻壳壱壹処处備备複复復复頭头誇夸奪夺奮奋奨奖粧妆婦妇姉姐娯娱孫孙寧宁実实審审憲宪宮宫寛宽賓宾対对尋寻導导層层歳岁島岛巣巢幣币帥帅師师帳帐帯带幹干並并併并広广荘庄慶庆庫库応应廃废開开異异棄弃弔弗張张弾弹強强帰归録录徴征徳德憶忆憂忧懐怀態态総总懇恳悪恶悩恼懸悬驚惊恵惠懲惩慣惯癒愈憤愤願愿戯戏戦战撲扑託托執执拡扩'
kanjistr += '掃扫揚扬護护報报抜拔擬拟擁拥択择掛挂揮挥損损換换拠据挿插捜搜摂摄収收効效敵敌勅敕斎斋無无時时曇昙顕显暁晓暫暂術术機机殺杀雑杂権权極极構构査查標标桟栈棟栋欄栏樹树様样橋桥検检桜樱歓欢歩步気气漢汉汚污湯汤溝沟涙泪潟泻沢泽潔洁濁浊測测済济濃浓渦涡潤润渋涩漬渍漸渐漁渔渓溪満满濫滥浜滨瀬濑滅灭霊灵災灾砲炮錬炼煙烟煩烦焼烧熱热薫熏愛爱犠牺猶犹獄狱猟猎環环現现璽玺電电療疗塩盐監监盤盘矯矫鉱矿礎础確确砕碎禍祸離离'
kanjistr += '種种積积稲稻窮穷窯窑窓窗競竞篤笃築筑簡简類类糧粮粋粹緊紧糾纠紅红繊纤約约級级紀纪緯纬純纯綱纲納纳縦纵紛纷紙纸紋纹紡纺線线紺绀練练組组紳绅細细織织終终紹绍経经結结絵绘給给絡络絶绝絞绞統统絹绢継继績绩緒绪続续縄绳維维綿绵緑绿緩缓締缔編编縁缘縛缚縫缝縮缩繕缮繰缲缶罐網网羅罗罰罚罷罢職职粛肃腸肠膚肤脹胀脅胁勝胜臓脏脳脑騰腾舎舍艦舰芸艺節节範范繭茧薦荐栄荣薬药獲获蛍萤営营蔵藏虜虏慮虑襲袭見见観观規规視视覧览'
kanjistr += '覚觉謄誊計计訂订認认討讨譲让訓训議议記记講讲許许論论訟讼設设訪访証证評评識识詐诈訴诉診诊詞词詔诏訳译試试詩诗詰诘誠诚話话誕诞該该詳详語语誤误誘诱説说請请諸诸諾诺読读課课調调談谈謀谋謁谒諭谕諮谘謝谢謡谣謙谦謹谨譜谱穀谷貝贝貞贞負负貢贡財财責责賢贤敗败貨货質质販贩貧贫購购貯贮貫贯貴贵貸贷貿贸費费賀贺賊贼賄贿賃赁資资賦赋賞赏賜赐賠赔頼赖賛赞贈赠躍跃車车軌轨軒轩転转輪轮軟软軸轴軽轻載载較较輩辈輝辉輸输轄辖'
kanjistr += '辺边遼辽達达遷迁過过運运還还進进遠远違违連连遅迟適适選选遺遗郵邮醸酿酔醉酢醋採采釈释裏里鑑鉴針针釣钓鈍钝鐘钟鋼钢銭钱鉢钵鉄铁鈴铃鉛铅銅铜銑铣銘铭銃铳銀银鋳铸舗铺鎖锁鋭锐錯错錘锤錠锭鍛锻鎮镇鏡镜長长門门閉闭問问閑闲間间聞闻閥阀閣阁閲阅隊队陽阳陰阴陣阵階阶際际陸陆陳陈険险陥陷隠隐隷隶難难彫雕霧雾覇霸韻韵頂顶項项順顺頑顽顧顾頒颁預预領领頻频題题顔颜額额風风飛飞飢饥飯饭飲饮飾饰飽饱飼饲餓饿館馆馬马駄驮駆驱'
kanjistr += '駐驻駅驿験验騎骑騒骚髄髓魚鱼鮮鲜鯨鲸鳥鸟鶏鸡鳴鸣黒黑黙默斉齐歯齿齢龄竜龙亀龟戸户藍蓝夾夹頬颊跡迹佇伫鬱郁呑吞乗乘暢畅儲储嘩哗補补渉涉腫腫雰氛穏稳頓顿鍋锅餅饼嵐岚蘇苏駒驹馴驯馳驰諦谛鍵键囁嗫潰溃駝驼駁驳驥骥驟骤駿骏驃骠騙骗筆笔楊杨'
i = 0
kanjistr = unicode(kanjistr, 'utf8')
kanji = {}
while i < len(kanjistr):
ch = kanjistr[i + 1]
kanji[kanjistr[i + 1]] = kanjistr[i]
i += 2
str = sys.argv[1].decode('utf8')
i = 0
result = ''
while i < len(str):
ch = str[i]
v = kanji.get(ch)
if v == None:
result = result + str[i]
else:
result = result + v
i += 1
print(result.encode('utf8'))