モジュール:CharacterJPN
モジュール:CharacterJPNは、日本語環境固有の文字処理を提供します。
- 関数kanji_old2newは、テキスト中の旧字を新字に置き換えます。
- 引数textで新字に置き換えるテキストを指定します。
- 引数oldnewで新旧字以外の変換前後文字を旧新旧新旧新…の順に一列に並べます。
- 引数exoldとexnewで新旧字以外の変換前文字と変換後文字を一つ以上指定します。
- 上述の引数oldnewとexold,exnewは併用できます。同じ旧字が含まれる場合は、oldnewよりexnewが優先されます。
- exoldとexnewは一文字ずつがそれぞれ組になる必要がありますが、漢字を等幅表示できない環境ではそれぞれの漢字の横座標がずれて閲覧・編集しにくいのでoldnewの使用をお勧めします。
- 引数excludeで新字への変換を行わない旧字を一つ以上指定します。ただし異体字セレクター使用領域(U+F900からU+FAFF、U+2F800からU+2FA1Fなど)は必ず新字に変換されます。
- 「萬」や「龍」など今も広く用いられている旧字を新字に変換したくない時に有用です。
- 関数kanji_old2newで旧字を新字に変換した例を以下に示します。引数oldnewで新旧字体だけでなく「脫」を「脱」に変換するなどしています。引数excludeで旧字の「眞」と「卷」を新字変換から除外しています。
- 入力
{{#Invoke:CharacterJPN|kanji_old2new |text=成吉思汗實錄卷の三、帖木眞、合撒兒、脫斡哩勒 |oldnew=內内吳呉吿告姬姫寗寧尙尚强強戶戸旣既朵朶歲歳煑煮產産眾衆稅税絕絶繫繋脫脱說説銳鋭雞鶏頰頬顚顛 |exclude=眞卷}}
- 出力
成吉思汗実録卷の三、帖木眞、合撒児、脱斡哩勒
- 関数replace_kanji_number_to_arabicは、テキスト中の漢数字や全角数字を算用数字に置き換えます。
- 引数textで算用数字に置き換えるテキストを指定します。
- 引数ketaでゼロ埋めする桁数を数字で指定します。何も指定しない場合はゼロ埋めされません。
- 引数errstrで不正な漢数字書式だった場合に出力するエラー文字列を指定します。何も指定しない場合は該当部分文字列が除去され、「ignore」を指定した場合はそのままになります。
- 引数trimfirstに'1'を指定すると最初に見つかった数字に置き換えます。
- 関数replace_kanji_number_to_arabicでテキスト中の漢数字や全角数字を算用数字に変換した例を以下に示します。「二十万四億」は不正な漢数字書式なので「エラー」に置き換わります。
- 入力
{{#Invoke:CharacterJPN|replace_kanji_number_to_arabic |text=見本Aは三兆百五十億十七、見本Bは二十万四億、見本Cは廿二です|keta=5|errstr=エラー}}
- 出力
見本Aは3015000000017、見本Bはエラー、見本Cは00022です
- 入力
{{#Invoke:CharacterJPN|replace_kanji_number_to_arabic |text=見本Aは四十兆百五十億十七、見本Bは二十万四億、見本Cは廿二です|keta=5|errstr=エラー|trimfirst=1}}
- 出力
40015000000017
local bi = {}
local l_kshinkyuu = {}
local l_ksujidic = {}
function bi.kanji_old2new(frame)
return bi.kanji_old2new_direct2(frame.args['text'], frame.args['oldnew'], frame.args['exclude'], frame.args['exold'], frame.args['exnew'])
end
function bi.kanji_old2new_direct(intext, inexold, inexnew)
local text = intext or ''
local exold = inexold or ''
local exnew = inexnew or ''
bi._reset_kshinkyuu_table('', '', exold, exnew)
local content = mw.ustring.gsub(text, '(.)', bi._fnc_kanji_old2new)
return content
end
function bi.kanji_old2new_direct2(intext, inoldnew, inexclude, inexold, inexnew)
local text = intext or ''
local oldnew = inoldnew or ''
local exclude = inexclude or ''
local exold = inexold or ''
local exnew = inexnew or ''
bi._reset_kshinkyuu_table(oldnew, exclude, exold, exnew)
local content = mw.ustring.gsub(text, '(.)', bi._fnc_kanji_old2new)
return content
end
function bi._fnc_kanji_old2new(c1)
return l_kshinkyuu[c1] or c1
end
function bi._reset_kshinkyuu_table(oldnew, exclude, exold, exnew)
l_kshinkyuu = {}
l_kshinkyuu['乘'] = '乗'
l_kshinkyuu['亂'] = '乱'
l_kshinkyuu['亞'] = '亜'
l_kshinkyuu['佛'] = '仏'
l_kshinkyuu['來'] = '来'
l_kshinkyuu['倂'] = '併'
l_kshinkyuu['假'] = '仮'
l_kshinkyuu['傳'] = '伝'
l_kshinkyuu['僞'] = '偽'
l_kshinkyuu['價'] = '価'
l_kshinkyuu['儉'] = '倹'
l_kshinkyuu['兒'] = '児'
l_kshinkyuu['兩'] = '両'
l_kshinkyuu['册'] = '冊'
l_kshinkyuu['剩'] = '剰'
l_kshinkyuu['劍'] = '剣'
l_kshinkyuu['劑'] = '剤'
l_kshinkyuu['勞'] = '労'
l_kshinkyuu['勳'] = '勲'
l_kshinkyuu['勵'] = '励'
l_kshinkyuu['勸'] = '勧'
l_kshinkyuu['區'] = '区'
l_kshinkyuu['卷'] = '巻'
l_kshinkyuu['卽'] = '即'
l_kshinkyuu['參'] = '参'
l_kshinkyuu['單'] = '単'
l_kshinkyuu['嚴'] = '厳'
l_kshinkyuu['囑'] = '嘱'
l_kshinkyuu['圈'] = '圏'
l_kshinkyuu['國'] = '国'
l_kshinkyuu['圍'] = '囲'
l_kshinkyuu['圓'] = '円'
l_kshinkyuu['圖'] = '図'
l_kshinkyuu['團'] = '団'
l_kshinkyuu['堯'] = '尭'
l_kshinkyuu['增'] = '増'
l_kshinkyuu['墮'] = '堕'
l_kshinkyuu['壓'] = '圧'
l_kshinkyuu['壘'] = '塁'
l_kshinkyuu['壞'] = '壊'
l_kshinkyuu['壤'] = '壌'
l_kshinkyuu['壯'] = '壮'
l_kshinkyuu['壹'] = '壱'
l_kshinkyuu['壽'] = '寿'
l_kshinkyuu['奧'] = '奥'
l_kshinkyuu['奬'] = '奨'
l_kshinkyuu['孃'] = '嬢'
l_kshinkyuu['學'] = '学'
l_kshinkyuu['寢'] = '寝'
l_kshinkyuu['實'] = '実'
l_kshinkyuu['寫'] = '写'
l_kshinkyuu['寬'] = '寛'
l_kshinkyuu['寶'] = '宝'
l_kshinkyuu['將'] = '将'
l_kshinkyuu['專'] = '専'
l_kshinkyuu['對'] = '対'
l_kshinkyuu['屆'] = '届'
l_kshinkyuu['屬'] = '属'
l_kshinkyuu['峽'] = '峡'
l_kshinkyuu['嶽'] = '岳'
l_kshinkyuu['巖'] = '巌'
l_kshinkyuu['巢'] = '巣'
l_kshinkyuu['帶'] = '帯'
l_kshinkyuu['廢'] = '廃'
l_kshinkyuu['廣'] = '広'
l_kshinkyuu['廳'] = '庁'
l_kshinkyuu['彈'] = '弾'
l_kshinkyuu['彌'] = '弥'
l_kshinkyuu['徑'] = '径'
l_kshinkyuu['從'] = '従'
l_kshinkyuu['徵'] = '徴'
l_kshinkyuu['德'] = '徳'
l_kshinkyuu['恆'] = '恒'
l_kshinkyuu['惠'] = '恵'
l_kshinkyuu['惡'] = '悪'
l_kshinkyuu['惱'] = '悩'
l_kshinkyuu['愼'] = '慎'
l_kshinkyuu['慘'] = '惨'
l_kshinkyuu['應'] = '応'
l_kshinkyuu['懷'] = '懐'
l_kshinkyuu['戀'] = '恋'
l_kshinkyuu['戰'] = '戦'
l_kshinkyuu['戲'] = '戯'
l_kshinkyuu['戾'] = '戻'
l_kshinkyuu['拂'] = '払'
l_kshinkyuu['拔'] = '抜'
l_kshinkyuu['拜'] = '拝'
l_kshinkyuu['挾'] = '挟'
l_kshinkyuu['插'] = '挿'
l_kshinkyuu['揭'] = '掲'
l_kshinkyuu['搖'] = '揺'
l_kshinkyuu['搜'] = '捜'
l_kshinkyuu['擇'] = '択'
l_kshinkyuu['擊'] = '撃'
l_kshinkyuu['擔'] = '担'
l_kshinkyuu['據'] = '拠'
l_kshinkyuu['擧'] = '挙'
l_kshinkyuu['擴'] = '拡'
l_kshinkyuu['攝'] = '摂'
l_kshinkyuu['收'] = '収'
l_kshinkyuu['效'] = '効'
l_kshinkyuu['敍'] = '叙'
l_kshinkyuu['敕'] = '勅'
l_kshinkyuu['數'] = '数'
l_kshinkyuu['斷'] = '断'
l_kshinkyuu['晉'] = '晋'
l_kshinkyuu['晚'] = '晩'
l_kshinkyuu['晝'] = '昼'
l_kshinkyuu['曆'] = '暦'
l_kshinkyuu['曉'] = '暁'
l_kshinkyuu['曾'] = '曽'
l_kshinkyuu['會'] = '会'
l_kshinkyuu['條'] = '条'
l_kshinkyuu['棧'] = '桟'
l_kshinkyuu['榮'] = '栄'
l_kshinkyuu['槇'] = '槙'
l_kshinkyuu['槪'] = '概'
l_kshinkyuu['樂'] = '楽'
l_kshinkyuu['樓'] = '楼'
l_kshinkyuu['樞'] = '枢'
l_kshinkyuu['樣'] = '様'
l_kshinkyuu['橫'] = '横'
l_kshinkyuu['檢'] = '検'
l_kshinkyuu['櫻'] = '桜'
l_kshinkyuu['權'] = '権'
l_kshinkyuu['歐'] = '欧'
l_kshinkyuu['歡'] = '歓'
l_kshinkyuu['步'] = '歩'
l_kshinkyuu['歷'] = '歴'
l_kshinkyuu['歸'] = '帰'
l_kshinkyuu['殘'] = '残'
l_kshinkyuu['殼'] = '殻'
l_kshinkyuu['毆'] = '殴'
l_kshinkyuu['每'] = '毎'
l_kshinkyuu['氣'] = '気'
l_kshinkyuu['沒'] = '没'
l_kshinkyuu['涉'] = '渉'
l_kshinkyuu['淚'] = '涙'
l_kshinkyuu['淨'] = '浄'
l_kshinkyuu['淺'] = '浅'
l_kshinkyuu['渴'] = '渇'
l_kshinkyuu['溪'] = '渓'
l_kshinkyuu['溫'] = '温'
l_kshinkyuu['滯'] = '滞'
l_kshinkyuu['滿'] = '満'
l_kshinkyuu['潛'] = '潜'
l_kshinkyuu['澁'] = '渋'
l_kshinkyuu['澤'] = '沢'
l_kshinkyuu['濕'] = '湿'
l_kshinkyuu['濟'] = '済'
l_kshinkyuu['濱'] = '浜'
l_kshinkyuu['瀧'] = '滝'
l_kshinkyuu['瀨'] = '瀬'
l_kshinkyuu['灣'] = '湾'
l_kshinkyuu['燈'] = '灯'
l_kshinkyuu['燒'] = '焼'
l_kshinkyuu['營'] = '営'
l_kshinkyuu['爐'] = '炉'
l_kshinkyuu['爭'] = '争'
l_kshinkyuu['爲'] = '為'
l_kshinkyuu['犧'] = '犠'
l_kshinkyuu['狀'] = '状'
l_kshinkyuu['狹'] = '狭'
l_kshinkyuu['獨'] = '独'
l_kshinkyuu['獵'] = '猟'
l_kshinkyuu['獸'] = '獣'
l_kshinkyuu['獻'] = '献'
l_kshinkyuu['瑤'] = '瑶'
l_kshinkyuu['瓣'] = '弁'
l_kshinkyuu['甁'] = '瓶'
l_kshinkyuu['畫'] = '画'
l_kshinkyuu['當'] = '当'
l_kshinkyuu['疊'] = '畳'
l_kshinkyuu['瘦'] = '痩'
l_kshinkyuu['癡'] = '痴'
l_kshinkyuu['發'] = '発'
l_kshinkyuu['盜'] = '盗'
l_kshinkyuu['盡'] = '尽'
l_kshinkyuu['眞'] = '真'
l_kshinkyuu['硏'] = '研'
l_kshinkyuu['碎'] = '砕'
l_kshinkyuu['祕'] = '秘'
l_kshinkyuu['祿'] = '禄'
l_kshinkyuu['禪'] = '禅'
l_kshinkyuu['禮'] = '礼'
l_kshinkyuu['稱'] = '称'
l_kshinkyuu['稻'] = '稲'
l_kshinkyuu['穗'] = '穂'
l_kshinkyuu['穩'] = '穏'
l_kshinkyuu['穰'] = '穣'
l_kshinkyuu['竊'] = '窃'
l_kshinkyuu['竝'] = '並'
l_kshinkyuu['粹'] = '粋'
l_kshinkyuu['絲'] = '糸'
l_kshinkyuu['經'] = '経'
l_kshinkyuu['綠'] = '緑'
l_kshinkyuu['緖'] = '緒'
l_kshinkyuu['緣'] = '縁'
l_kshinkyuu['縣'] = '県'
l_kshinkyuu['縱'] = '縦'
l_kshinkyuu['總'] = '総'
l_kshinkyuu['繩'] = '縄'
l_kshinkyuu['繪'] = '絵'
l_kshinkyuu['繼'] = '継'
l_kshinkyuu['續'] = '続'
l_kshinkyuu['纖'] = '繊'
l_kshinkyuu['缺'] = '欠'
l_kshinkyuu['罐'] = '缶'
l_kshinkyuu['聰'] = '聡'
l_kshinkyuu['聲'] = '声'
l_kshinkyuu['聽'] = '聴'
l_kshinkyuu['肅'] = '粛'
l_kshinkyuu['腦'] = '脳'
l_kshinkyuu['膽'] = '胆'
l_kshinkyuu['臟'] = '臓'
l_kshinkyuu['臺'] = '台'
l_kshinkyuu['與'] = '与'
l_kshinkyuu['舊'] = '旧'
l_kshinkyuu['舍'] = '舎'
l_kshinkyuu['舖'] = '舗'
l_kshinkyuu['艷'] = '艶'
l_kshinkyuu['莊'] = '荘'
l_kshinkyuu['莖'] = '茎'
l_kshinkyuu['萬'] = '万'
l_kshinkyuu['薰'] = '薫'
l_kshinkyuu['藏'] = '蔵'
l_kshinkyuu['藝'] = '芸'
l_kshinkyuu['藥'] = '薬'
l_kshinkyuu['處'] = '処'
l_kshinkyuu['虛'] = '虚'
l_kshinkyuu['號'] = '号'
l_kshinkyuu['螢'] = '蛍'
l_kshinkyuu['蟲'] = '虫'
l_kshinkyuu['蠶'] = '蚕'
l_kshinkyuu['蠻'] = '蛮'
l_kshinkyuu['衞'] = '衛'
l_kshinkyuu['裝'] = '装'
l_kshinkyuu['襃'] = '褒'
l_kshinkyuu['覺'] = '覚'
l_kshinkyuu['覽'] = '覧'
l_kshinkyuu['觀'] = '観'
l_kshinkyuu['觸'] = '触'
l_kshinkyuu['謠'] = '謡'
l_kshinkyuu['證'] = '証'
l_kshinkyuu['譯'] = '訳'
l_kshinkyuu['譽'] = '誉'
l_kshinkyuu['讀'] = '読'
l_kshinkyuu['變'] = '変'
l_kshinkyuu['讓'] = '譲'
l_kshinkyuu['豐'] = '豊'
l_kshinkyuu['豫'] = '予'
l_kshinkyuu['貳'] = '弐'
l_kshinkyuu['賣'] = '売'
l_kshinkyuu['賴'] = '頼'
l_kshinkyuu['贊'] = '賛'
l_kshinkyuu['踐'] = '践'
l_kshinkyuu['輕'] = '軽'
l_kshinkyuu['轉'] = '転'
l_kshinkyuu['辨'] = '弁'
l_kshinkyuu['辭'] = '辞'
l_kshinkyuu['辯'] = '弁'
l_kshinkyuu['遙'] = '遥'
l_kshinkyuu['遞'] = '逓'
l_kshinkyuu['遲'] = '遅'
l_kshinkyuu['邊'] = '辺'
l_kshinkyuu['郞'] = '郎'
l_kshinkyuu['鄕'] = '郷'
l_kshinkyuu['醉'] = '酔'
l_kshinkyuu['醫'] = '医'
l_kshinkyuu['釀'] = '醸'
l_kshinkyuu['釋'] = '釈'
l_kshinkyuu['錄'] = '録'
l_kshinkyuu['錢'] = '銭'
l_kshinkyuu['鍊'] = '錬'
l_kshinkyuu['鎭'] = '鎮'
l_kshinkyuu['鐵'] = '鉄'
l_kshinkyuu['鑄'] = '鋳'
l_kshinkyuu['鑛'] = '鉱'
l_kshinkyuu['關'] = '関'
l_kshinkyuu['陷'] = '陥'
l_kshinkyuu['隨'] = '随'
l_kshinkyuu['險'] = '険'
l_kshinkyuu['隱'] = '隠'
l_kshinkyuu['隸'] = '隷'
l_kshinkyuu['雙'] = '双'
l_kshinkyuu['雜'] = '雑'
l_kshinkyuu['霸'] = '覇'
l_kshinkyuu['靈'] = '霊'
l_kshinkyuu['靜'] = '静'
l_kshinkyuu['顏'] = '顔'
l_kshinkyuu['顯'] = '顕'
l_kshinkyuu['飜'] = '翻'
l_kshinkyuu['飮'] = '飲'
l_kshinkyuu['餘'] = '余'
l_kshinkyuu['餠'] = '餅'
l_kshinkyuu['騷'] = '騒'
l_kshinkyuu['驅'] = '駆'
l_kshinkyuu['驗'] = '験'
l_kshinkyuu['驛'] = '駅'
l_kshinkyuu['髓'] = '髄'
l_kshinkyuu['體'] = '体'
l_kshinkyuu['髮'] = '髪'
l_kshinkyuu['鬭'] = '闘'
l_kshinkyuu['鷄'] = '鶏'
l_kshinkyuu['鹽'] = '塩'
l_kshinkyuu['麥'] = '麦'
l_kshinkyuu['麵'] = '麺'
l_kshinkyuu['黃'] = '黄'
l_kshinkyuu['黑'] = '黒'
l_kshinkyuu['默'] = '黙'
l_kshinkyuu['點'] = '点'
l_kshinkyuu['黨'] = '党'
l_kshinkyuu['齊'] = '斉'
l_kshinkyuu['齋'] = '斎'
l_kshinkyuu['齒'] = '歯'
l_kshinkyuu['齡'] = '齢'
l_kshinkyuu['龍'] = '竜'
l_kshinkyuu['龜'] = '亀'
for idx = 0xFE00, 0xFE0F do
l_kshinkyuu[mw.ustring.char(idx)] = ''
end
for idx = 1, #exclude do
l_kshinkyuu[mw.ustring.sub(exclude, idx, idx)] = nil
end
for idx = 1, #oldnew, 2 do
l_kshinkyuu[mw.ustring.sub(oldnew, idx, idx)] = mw.ustring.sub(oldnew, idx + 1, idx + 1)
end
for idx = 1, #exnew do
l_kshinkyuu[mw.ustring.sub(exold, idx, idx)] = mw.ustring.sub(exnew, idx, idx)
end
end
local k_suji_rgset = '0-9〇一二三四五六七八九零壱弐参肆伍陸質捌玖零壹貳參十百千拾佰廿丗卅仟十陌阡万億兆萬京0-9'
local l_keta = ''
local l_errstr = ''
function bi.replace_kanji_number_to_arabic(frame)
local content = bi.replace_kanji_number_to_arabic_direct(frame.args['text'], frame.args['keta'], frame.args['errstr'], frame.args['trimfirst'])
return content
end
function bi.replace_kanji_number_to_arabic_direct(text, keta, errstr, trimfirst)
l_keta = keta or ''
l_errstr = errstr or ''
trimfirst = trimfirst or ''
local content = text
if trimfirst == '1' then
content = mw.ustring.gsub(content, '^[^' .. k_suji_rgset .. ']*([' .. k_suji_rgset .. ']+).*$', '%1')
end
content = mw.ustring.gsub(content, '([' .. k_suji_rgset .. ']+)', bi.rplfnc_kanji_number_to_arabic)
return content
end
function bi.rplfnc_kanji_number_to_arabic(c1)
if mw.ustring.match(c1, '^([' .. k_suji_rgset .. ']+)') == nil then
return c1
end
return bi.kanji_number_to_arabic1(c1, l_keta, l_errstr)
end
function bi.kanji_number_to_arabic1(kanjinum, keta, errstr)
errstr = errstr or ''
if errstr == 'ignore' then
errstr = kanjinum
end
keta = keta or ''
local result = 0
local result_arabic = 0
local format = 0
local back_suji = -1
local back4 = 0
local back_keta = 0
local back_4keta = 0
local four = 0 -- 0:undefined, 1:arabic format, 2:kanji format, 3:kanji number
local current = -1
if l_ksujidic['0'] == nil then
bi._reset_ksujidic_table()
end
for idx = 1, mw.ustring.len(kanjinum) do
local ch = mw.ustring.sub(kanjinum, idx, idx)
local data1 = l_ksujidic[ch]
if data1 == nil then
return errstr
end
current = data1[1]
local type1 = data1[2]
if type1 == 'A' then
result_arabic = current + (result_arabic * 10)
four = current + (four * 10)
if format ~= 1 and four > 9999 then
return errstr
end
if idx > 1 then
if format == 0 and back_keta == 0 then
format = 1
end
end
back_suji = current
elseif type1 == 'T' then
format = 2
if back_4keta ~= 0 and back_4keta <= current then
return errstr
end
if back_suji > 0 then
back4 = back4 + back_suji * current
else
back4 = back4 + current
end
back_4keta = current
back_suji = -1
four = 0
elseif type1 == 'M' then
if back_suji == -1 and back4 == 0 then
return errstr
end
if back_keta ~= 0 and back_keta <= current then
return errstr
end
if format == 2 then
if back_suji > 0 then
back4 = back4 + back_suji
end
result = result + (back4 * current)
elseif four > 0 then
if four > 9999 then
return errstr
end
result = result + (four * current)
format = 3
end
back_keta = current
-- reset
back_4keta = 0
back_suji = -1
back4 = 0
four = 0
end
end
if format == 2 then
if back_suji > 0 then
back4 = back4 + back_suji
end
result = result + back4
else
result = result + four
end
if format == 1 then
result = result_arabic
end
return mw.ustring.format('%0' .. keta .. 'd', result)
end
function bi._reset_ksujidic_table()
l_ksujidic = {}
l_ksujidic['〇'] = {0, 'A'}
l_ksujidic['一'] = {1, 'A'}
l_ksujidic['二'] = {2, 'A'}
l_ksujidic['三'] = {3, 'A'}
l_ksujidic['四'] = {4, 'A'}
l_ksujidic['五'] = {5, 'A'}
l_ksujidic['六'] = {6, 'A'}
l_ksujidic['七'] = {7, 'A'}
l_ksujidic['八'] = {8, 'A'}
l_ksujidic['九'] = {9, 'A'}
l_ksujidic['零'] = {0, 'A'}
l_ksujidic['壱'] = {1, 'A'}
l_ksujidic['弐'] = {2, 'A'}
l_ksujidic['参'] = {3, 'A'}
l_ksujidic['肆'] = {4, 'A'}
l_ksujidic['伍'] = {5, 'A'}
l_ksujidic['陸'] = {6, 'A'}
l_ksujidic['質'] = {7, 'A'}
l_ksujidic['捌'] = {8, 'A'}
l_ksujidic['玖'] = {9, 'A'}
l_ksujidic['零'] = {0, 'A'}
l_ksujidic['壹'] = {1, 'A'}
l_ksujidic['貳'] = {2, 'A'}
l_ksujidic['參'] = {3, 'A'}
l_ksujidic['0'] = {0, 'A'}
l_ksujidic['1'] = {1, 'A'}
l_ksujidic['2'] = {2, 'A'}
l_ksujidic['3'] = {3, 'A'}
l_ksujidic['4'] = {4, 'A'}
l_ksujidic['5'] = {5, 'A'}
l_ksujidic['6'] = {6, 'A'}
l_ksujidic['7'] = {7, 'A'}
l_ksujidic['8'] = {8, 'A'}
l_ksujidic['9'] = {9, 'A'}
l_ksujidic['0'] = {0, 'A'}
l_ksujidic['1'] = {1, 'A'}
l_ksujidic['2'] = {2, 'A'}
l_ksujidic['3'] = {3, 'A'}
l_ksujidic['4'] = {4, 'A'}
l_ksujidic['5'] = {5, 'A'}
l_ksujidic['6'] = {6, 'A'}
l_ksujidic['7'] = {7, 'A'}
l_ksujidic['8'] = {8, 'A'}
l_ksujidic['9'] = {9, 'A'}
l_ksujidic['十'] = {10, 'T'}
l_ksujidic['百'] = {100, 'T'}
l_ksujidic['千'] = {1000, 'T'}
l_ksujidic['拾'] = {10, 'T'}
l_ksujidic['佰'] = {100, 'T'}
l_ksujidic['廿'] = {20, 'T'}
l_ksujidic['丗'] = {30, 'T'}
l_ksujidic['卅'] = {30, 'T'}
l_ksujidic['仟'] = {1000, 'T'}
l_ksujidic['十'] = {10, 'T'}
l_ksujidic['陌'] = {100, 'T'}
l_ksujidic['阡'] = {1000, 'T'}
l_ksujidic['万'] = {10000, 'M'}
l_ksujidic['億'] = {100000000, 'M'}
l_ksujidic['兆'] = {1000000000000, 'M'}
l_ksujidic['萬'] = {10000, 'M'}
l_ksujidic['京'] = {10000000000000000, 'M'}
end
return bi