2 # define local kanji features, by eto 2003-0305
3 # $Id: defkanji.rb,v 1.1 2003-11-10 08:11:46 eto Exp $
4 # Copyright (C) 2002-2003 Kouichirou Eto, All rights reserved.
5 # This is free software with ABSOLUTELY NO WARRANTY.
6 # You can redistribute it and/or modify it under the terms of the GNU GPL2.
11 class IDS_Definition #======================================================================
14 #●ids-element: stop-character。これ以上分割しない、基本要素文字。
15 #その文字自身を値として持つ。それ以外の値を持つ場合は、それを代りの値として使うことを意味する。
16 #つまり、101字の基本漢字は最小構成要素なので、それ以上分解しませんよ、ということ。
17 IDS_ELEMENT = "六百回交向歩考出書多少高可"
18 BASIC_KANJI = "人子女母父王口耳手足力目首毛心犬牛鳥貝角羽虫馬魚羊肉皮米竹木麦豆山川雨風水土石金田穴日月火音糸刀舟門戸衣矢弓車皿一二三四五六七八九十百千万寸尺上中下本玉立回食行止交向歩考入示走生出来書言大小白青多少高長"
20 AWASE_KANJI = "鳴名加品古知問間聞取兄見切分粉貧林森校東明住位好岩砂里男畑習休短空坂島倉美孝赤看光初努協解新歌語話張強忘悲答晴現正字安守灰秋秒困国医包同合舌居右左受友反道返迷花菜集机主太氷州点店庫仕帳幼防引配早直班筆重番北化比死夏後進酒福私家世内谷半原前寺思電雲気布旅衆泣"
22 #●ids-meaning: 意味的に考えるところのIDS。形としてはつながらないが、意味としてはこう分割できるというものを表す。
54 #●ids-represent: これを持つもつ字は、それ以外の字を意味するということを意味する。
55 #例えば人偏は、人を意味する。これは再帰的に摘要する。
87 #●ids-link: 横列びの関係があるもの
97 #show_ids(IDS_ELEMENT) #ar = BASIC_KANJI+IDS_ELEMENT
98 #show_ids(IDS_MEANING.join())
99 #show_ids(KanjiList.instance.joyo)
100 #show_ids(KanjiList.instance.awase(0))
101 #show_ids(open("0208-shell.txt").read)
103 #p "休".decompose.to_er
107 str.de_er.to_a.sort.uniq.each {|ch|
109 ids = char.decompose_all
110 print "#{char} #{ids.map_ucs}\n" #できるだけucsに正規化するべし。
117 exit if line.nil? || line =~ /end/
118 print "#{line.decompose} #{line.decompose.to_er}\n"
119 print "#{line.decompose_all} #{line.decompose_all.to_er}\n"
129 def define_ids_element
130 IDS_ELEMENT.each_char {|ch|
132 char.ids_element = ch
135 def define_ids_meaning
136 IDS_MEANING.each {|line|
137 next if line.nil? || line == "" || line =~ /^#/
140 char.ids_meaning = ids.de_er
141 print "#{ch} #{ids}\n"
144 def define_ids_represent
145 IDS_REPRESENT.each {|line|
146 next if line.nil? || line == "" || line =~ /^#/
149 char.ids_represent = rep.de_er
150 print "#{char.map_ucs} #{rep}\n"
154 IDS_LINK.each {|line|
155 next if line.nil? || line == "" || line =~ /^#/
158 char.ids_link = rep.de_er
159 print "#{char.map_ucs} #{rep}\n"
167 $LOAD_PATH << '../../src'
170 ide = CHISE::IDS_Definition.instance
176 #----------------------------------------------------------------------end.