Hiroyuki Komatsu
komat****@users*****
2004年 12月 10日 (金) 20:23:56 JST
Index: suikyo/ruby/doc/index.html diff -u suikyo/ruby/doc/index.html:1.2 suikyo/ruby/doc/index.html:1.3 --- suikyo/ruby/doc/index.html:1.2 Sat Jan 31 16:23:25 2004 +++ suikyo/ruby/doc/index.html Fri Dec 10 20:23:56 2004 @@ -166,6 +166,96 @@ インスタンスです. </p> + <h2>SuikyoComposer</h2> + <p> + SuikyoComposer は Suikyo を活用した、かな漢字変換用のプリエディット + ライブラリです。予測入力システム PRIME は SuikyoComposer を利用して + プリエディット機能を実現しています。 + </p> + + <h2>SuikyoComposer のサンプルコード</h2> +<pre> +#!/usr/bin/env ruby + +$KCODE= 'e' + +require 'suikyo/suikyo-composer' + +class TestSuikyo + def initialize () + table = ( ARGV[0] or "romaji" ) + + @suikyo = SuikyoComposer.new() + @suikyo.set_table(table) + @suikyo.set_reverse_table(table + "_reverse") + case table + when "romaji" then + @suikyo.hybrid_typing = true + when "tcode" then + @suikyo.mask = true + end + end + + def edit (string) + if string.index("^") == 0 then + string[1..-1].split(//).each { | command | + case ( command ) + when "b" then + @suikyo.cursor_left() + when "a" then + @suikyo.cursor_left_edge() + when "f" then + @suikyo.cursor_right() + when "e" then + @suikyo.cursor_right_edge() + when "h" then + @suikyo.edit_backspace() + when "d" then + @suikyo.edit_delete() + when "z" then + @suikyo.undo() + when "1" then + @suikyo.set_mode_hybrid() + when "6" then # F6 + @suikyo.set_mode_default() + when "7" then # F7 + @suikyo.set_mode_katakana() + when "8" then # F8 + @suikyo.set_mode_half_katakana() + when "9" then # F9 + @suikyo.set_mode_wide_ascii() + when "0" then # F10 + @suikyo.set_mode_raw() + when "-" then + @suikyo.edit_erase() + when "!" then + p****@suiky*****_get_expansion() + when "=" then + p****@suiky*****_get_preediting_string() + when "?" then + p****@suiky*****_get_query_string() + end + } + else + @suikyo.edit_insert(string) + end + @suikyo.edit_display() + end + + def main () + loop { + print "> " + line = $stdin.gets + line.chomp! + edit(line) + } + end +end + +test = TestSuikyo.new() +test.main() +</pre> + <h2>インストール</h2> <p> <a href="../index.html#install">suikyo 全般のページ</a>を参照して下さい. @@ -209,7 +299,7 @@ <div class="id" align="right"> 小松 弘幸 <komat****@taiya*****><br> - $Id: index.html,v 1.2 2004/01/31 07:23:25 komatsu Exp $ + $Id: index.html,v 1.3 2004/12/10 11:23:56 komatsu Exp $ </div> <!-- End Footer -->