Ruby/CHISE
â Ruby/CHISEã¨ã¯
Ruby/CHISEã¯ï¼XEmacs CHISEã«ãããChaonå®è£ ãRubyã¸ç§»æ¤ãããã¨ã試ã¿ãã¢ã¸ã¥ã¼ã«ã§ãï¼
Chaonã¢ãã«ã¨ã¯
Chaonã¢ãã«ã¨ã¯ï¼æåã符å·ã§ã¯ãªãç´ æ§ã«ãã£ã¦æ±ãæ¹æ³ãæå³ãã¾ãï¼
Ruby/CHISEã§ã¯ãããæ¡å¼µãï¼æåããªãã¸ã§ã¯ãã¨ãã¦æ±ã£ã¦ãã¾ãï¼
â download
ææ°ç
æåãã¼ã¿ãã¼ã¹
Ruby/CHISEã使ãã«ã¯ï¼å¥éæåãã¼ã¿ãã¼ã¹ãç¨æããå¿ è¦ãããã¾ãï¼ æåãã¼ã¿ãã¼ã¹ã¯XEmacs CHISEã¨ä¸ç·ã«é ä»ããã¦ã¾ããï¼ å¿ è¦ãªç°å¢(GNU/Linux)ãç¨æã§ããªã人ãããããï¼ æåãã¼ã¿ãã¼ã¹ã®ã¿ãåãåºãããã¡ã¤ã«ãç¨æãã¾ããï¼
- 2003-11-04 : char-db.tar.gz Windowsç¨
Linuxã§XEmacs CHISEãinstallãï¼ä»å±ã®mkdbtarball.rbã使ã£ãä½æãã.tar.gzã«ãããã®ï¼ - 2003-11-04 : char-db-linux.tar.bz2 Linuxç¨
/usr/local/lib/xemacs-21.4.12/i686-pc-linux/char-db以ä¸ãtar.bz2ã«ãããã®ï¼
CVS access
CVSã«ããå ¥æãã§ãã¾ãï¼
ã©ã¤ã»ã³ã¹
GPLã§ãï¼COPYINGãããããã ããï¼
â install
chise以ä¸ãï¼é©å½ãªdirectoryã«ç§»åãã¾ãï¼
ä¾:
# mv chise /usr/local/lib/ruby/site_ruby/1.8
é常ï¼/usr/local/lib/ruby/site_ruby/以ä¸ã«installããã¾ãï¼
æ¡å¼µã©ã¤ãã©ãªã¯ï¼ext以ä¸ã«cdãï¼ä¸è¨ã®ããã«æã¡è¾¼ã¿ã¾ãï¼
% ruby extconf.rb % make # make install
æ¡å¼µã©ã¤ãã©ãªãç¡ãã¦ãåä½ãã¾ãï¼ããå ´åã¯ï¼é«éåãã¾ãï¼
config
chise/config.rbå ããã³ï¼ext/config.hå ã«ã¦
DB_DIR = '/usr/local/lib/xemacs-21.4.10/i686-pc-linux/char-db'
ãªã©ãå¿
è¦ã«å¿ãã¦å¤æ´ãã¦ãã ããï¼
IDS_DB_DIR = '/home/eto/work/chise/ids/''
IDSã®ããã¹ããã¡ã¤ã«ãç½®ããã¦ãããã£ã¬ã¯ããªã¼ãæãã¾ãï¼(ä¸è¨ã®åå½¢å解ã»åæã«ã¤ãã¦ãåç
§ï¼)
ä¾åé¢ä¿
ä¸è¨ã®ããã±ã¼ã¸ãå¿ è¦ã§ãï¼
- db3-3.2.9以ä¸
- bdb-0.5.0以ä¸
- ruby 1.8.1以ä¸
ä¸è¬ã«Rubyã®ããã±ã¼ã¸ã¯ RAAã使ã£ã¦æ¢ããã¨ãã§ãã¾ãï¼
Unicode
ç¾ç¶ã§ã¯ï¼Ruby/CHISEã«æ¸¡ãæåã³ã¼ãã¯UTF-8ã®Unicodeã«ãã¦ããã¨ä¾¿å©ã§ãï¼
å°æ¥çã«ã¯ããã°ã©ã èªä½ãSJISï¼EUCãªã©ã§æ¸ããã¦ãã¦ã åé¡ãªãå¦çã§ããããã«ãããã¨æã£ã¦ãã¾ãï¼
Windowsã§Unicodeã使ããã¨ãã£ã¿ã¼ã¨ãã¦ï¼Meadow + Mule-UCSã使ãã¾ãï¼
ããªã¼ã®Unicode対å¿ã¨ãã£ã¿ã¼ã¨ãã¦ããµã¯ã©ã¨ãã£ã¿ãã使ãã¾ãï¼
ã¾ãï¼Windowsä»å±ã®ã¡ã¢å¸³ã使ãã¾ãï¼
è¦ãã ãã§ããã°IEã使ãã¾ãï¼
â 使ãæ¹
åºæ¬çãªä½¿ãæ¹
require "chise" str = "å" # Stringãæ¡å¼µãã¦ããï¼UTF8ã§ä¸ããï¼ p str.ucs # ãã®æåã®ucsã®å¤ã表示ãããï¼ p str.total_strokes # ç»æ°ã表示ãããï¼ p str.gb2312 # ãªã©ãªã©ï¼ str.each_feature {|f, v| # å ¨ç´ æ§ã表示ããï¼ print f, ": ", v, "\n" }
â åå½¢å解ã»åæ
Ruby/CHISEã¯ï¼ãã¨ãã¨åå½¢å解ã»åæãæ±ãããã«ä½ãããããï¼ãã®æ©è½ãå¼·åããã¦ãã¾ãï¼
åå½¢å解ã»åæã¯ï¼ç¾å¨ã¯Unicodeã«ãããIDS(Ideographic Description Structure)ã¨ããä»æ§ã«æºæ ãã¦ãã¾ãï¼ U+2FF0ãU+2FFBã§è¡¨ããããIDC(Ideographic Description Characters)ã«ãã£ã¦åææ¹æ³ãæå®ãï¼ããã«ç¶ãäºæåããä¸æåã®æåãåæãã¦è¡¨ç¤ºãã¾ãï¼
IDSã使ãããã®æºå
ä¸è¨ã®ããã«ãã¦ï¼IDSã®ããã¹ããã¡ã¤ã«ç¾¤ãæã£ã¦ãã¾ãï¼
% cd ~/work/chise (ãã®ãã£ã¬ã¯ããªã¼ã¯é©å®å¤æ´ãã) % cvs -d :pserver:[email protected]:/cvs/root login password: (ä½ãå ¥ããã«ãã ããä¸åº¦return) % cvs -d :pserver:[email protected]:/cvs/chise co -d ids ids
ãã®ããã«ããã¨ï¼IDSã®ããã¹ããã¡ã¤ã«ç¾¤ãæã£ã¦ãããã¨ãã§ãã¾ãï¼
ãã®å¾ï¼chise/config.rbå
ã®ï¼
IDS_DB_DIR = '/home/eto/work/chise/ids/''
ããã«ï¼ä¸è¨ã®IDSããã¹ããã¡ã¤ã«ç¾¤ãæã£ã¦ãããã£ã¬ã¯ããªã¼ãå
¥ãã¾ãï¼
ãã®ããã«ãã¦é©åã«IDS_DB_DIRãè¨å®ãï¼
./tools/idsdbdumpall.rbãå®è¡ãã¾ãï¼(ããªãæéããããã¾ãï¼)
ããã§ï¼æåç´ æ§ã¨ãã¦æ°ãã«idsãªã©ãå ããã¾ãï¼
åå½¢å解
Stringã«ï¼decompose, decompose_allã¨ããäºã¤ã®ã¡ã½ãããããã¾ãï¼ decomposeã¯ä¸æ®µéã ãå解ãã¾ãï¼decompose_allã¯ãããå帰çã«è¡ãã¾ãï¼
p "å".decompose p "å".decompose_all p "æ¦".decompose p "æ¦".decompose_all p "çµäº".decompose p "çµäº".decompose_all p "鬱".decompose p "鬱".decompose_all
æåã®èª¬æããï¼åå½¢å解ããã¦åºã¦ããçµæã®æååã«ã¯ï¼ IDSãã£ã©ã¯ã¿ã¼ãå«ã¾ãã¦ããããï¼ãã¾ã表示ãããªãå ´åãããã¾ãï¼ ã¡ã¢å¸³ã ã¨è¡¨ç¤ºã§ãã¾ãï¼
åå½¢åæ
åå½¢åæã¯ï¼composeã¡ã½ããã§è¡ãã¾ãï¼
p "⿰æ¨æ¨".compose
findã¡ã½ããã§ï¼ããé¨åãæ¼¢åã®ä¸é¨ã¨ãã¦å«ã¾ãã¦ããæ¼¢å群ãæ¢ããã¨ãã§ãã¾ãï¼
p "æ¥é²".find
ããã§ã¯ï¼æ¥ã¨é²ã¨ããé¨åãå«ã¾ãã¦ããå ¨æ¼¢åãåºåãã¾ãï¼
â 説æ
ç¾æç¹ã§ã¯ï¼test caseãè¦ãã»ãã使ãæ¹ã¯ããããããã§ãï¼
class String char å é ã®æåãCharacterã«å¤æãããã®ãè¿ã class Character [] ããç´ æ§ãgetãã¾ãï¼ åå¨ããªãç´ æ§ãåç §ããã¨ãã¯ï¼nilãè¿ãã£ã¦ãã¾ãï¼ []= ããç´ æ§ãputãã¾ãï¼
tools
- define-kanji-meaning.rb
- æ¼¢åã®æå³ã«ããå解ãè¡ãããã®æ å ±ãç´ æ§ã¨ãã¦å®ç¾©ãã¾ãï¼
- dump-database.rb
- æåãã¼ã¿ãã¼ã¹ãããã¹ãã¨ãã¦ãã³ããã¾ãï¼ä¸èº«ãè¦ããã¨ãã§ãã¾ãï¼
- make-chisedb-tarball.rb
-
Usage: make-chisedb-tarball.rb <directory of XEmacs CHISE> <tmp dir>
example. % ./make-chisedb-tarball.rb /usr/local/lib/xemacs-21.4.14/i686-pc-linux
XEmacs CHISEã®æåãã¼ã¿ãã¼ã¹ãï¼ä¸ã¤ã®tarballã«ã¾ã¨ãã¾ãï¼Windows㧠ã¯ä½¿ããªããã¡ã¤ã«åãé©å®å¤æ´ãã¾ãï¼UNIXä¸ã§ä½¿ãã¾ãï¼ Windowsã§tar.gzãå±éããã«ã¯ï¼ eoãããããã§ãï¼ - make-ids-database.rb
- IDSã®ããã¹ããã¡ã¤ã«ç¾¤ãèªã¿ãã¿ï¼ç´ æ§ã¨ãã¦ä½¿ããããã«ãã¾ãï¼ å®è¡ã«ã¯æéããããã¾ãï¼
- move-obsolete-files.rb
- ãã§ã«obsoleteã«ãªã£ãç´ æ§ã®BDBãã¡ã¤ã«ãobsolete directoryã«ç§»åããã¾ãï¼
- rename-files.rb
- å¤ãæ§é ã®æåãã¼ã¿ãã¼ã¹ã®ãã£ã¬ã¯ããªæ§é ãï¼æ°ãããã£ã¬ã¯ããªæ§é ã«ç´ãã¾ãï¼
- trim_bom.rb
- Unicodeãã¡ã¤ã«ãä½ã£ãã¨ãã®å é ã«ã¤ãã¦ããBOM(byte order mark)ãåé¤ãã¾ãï¼
â ä»å±libraryã®èª¬æ
- ext/*
Cè¨èªçã®libchiseãç¨ããextensionã§ãï¼ - network.rb, makegraph.rb, graphviz.rb, defkanji.rb, kanjilist.rb
æ¼¢åã®é¨åéã®æ¥ç¶é¢ä¿ãè¨ç®ãã¾ãï¼Graphvizã«ããã°ã©ãåãè¡ãã¾ãï¼ruby makegraph.rb
Graphvizãå¿ è¦ã§ãï¼min.svgãçæããã¾ãï¼
ruby defkanji.rb
æ¼¢åã®å®ç¾©ãè¡ãã¾ãï¼
- stroke.rb, kage.rb, kageserver.rb, csf.rb
StrokeFontãç¨ããã©ã¤ãã©ãªã¼ç¾¤ï¼ ä¸å°å®ä¸æ°ã«ããKAGE System, åç´ç´æ°ã«ããCSFã¨ããäºã¤ã®StrokeFontã使ãã¾ãï¼ å¥éãã©ã³ããã¡ã¤ã«ãå¿ è¦ã§ãï¼
csf.rbä¸ã®CSF_FONT_DIR = 'd:/work/chise/csf/'ãé©åã«è¨å®ãã¦ãã ããï¼sglã¨ããç¬èªã®ã°ã©ãã£ãã¯ã©ã¤ãã©ãªã¼ãå¿ è¦ã§ããï¼ããã¯ã¾ã éå ¬éã§ãï¼
ruby stroke.rb
æ¼¢åã®CodeTableã表ãï¼ãã®ä¸ã®æåã表示ã§ãã¾ãï¼
- æ¼¢åãã©ã³ãèªåçææè¡ãã©ã¼ã©ã
- KAGEã¢ãã«
- KST32ZX, ç¯æ風(Zhuanwen-Like),æ¼¢åStrokeFont(KST)
- KST32A, 極ãã¦ã³ã³ãã¯ããªJIS第ä¸æ°´æºæ¼¢å(éæ¼¢å)ã¹ããã¼ã¯ã»ãã¼ãã«
â discussion
Ruby/M17Nã¨ã®æ´åæ§
Ruby/M17Nã¨ã®æ´åæ§ãã©ãã¨ãã°ãããï¼
â links
â history
- 2003-0110 : ãã¹ãå ¬é
- 2003-0112 : XString追å
- 2003-0115 : IDSã®èªã¿è¾¼ã¿æ©è½Î²ç
- 2003-0116 : IDSã®èªã¿è¾¼ã¿æ©è½1.0
- 2003-0117 : XStringãå»æ¢ãï¼Stringã«ä¸æ¬åï¼IDSã®èªã¿è¾¼ã¿æ©è½ãå¼·åï¼
- 2003-0120 : IDS_Treeã®èªã¿è¾¼ã¿æ©è½ã追å ï¼æ¨æ§é ã®æ´åæ§checkã追å ï¼
- 2003-0130 : IDSã®éå¤ææ©è½ãªã©ã追å ï¼
- 2003-0213 : ruby-chise-20030213.tar.bz2
å称ãRuby/UTF-2000ããRuby/CHISEã¸ã¨å¤æ´ï¼ - 2003-0312 : ruby-chise-20030312.tar.bz2
æ§ã ãªã©ã¤ãã©ãªã追å ï¼ - 2003-1004 : ruby-chise-20031004.tar.bz2
æ°ããç´ æ§åã«å¯¾å¿ããï¼Copyright noticeããããï¼ - 2003-10-31 : LC2003ã«ã¦çºè¡¨ï¼
- 2003-1110 : ruby-chise-20031110.tar.bz2
ãã£ã¬ã¯ããªæ§é ãchise/*.rbã¨ãªãããã«å¤æ´ï¼installerãã¤ããï¼ - 2004-07-08 : ruby-chise-0.2.targz
libchiseã«å¯¾å¿ããï¼ä»ï¼å¤æ°ã®å¤æ´ï¼