# Copyright (C) 2002-2004 Kouichirou Eto, All rights reserved.
-$LOAD_PATH << "../../lib" if $0 == __FILE__
-require "chise"
-include CHISE
+require "chise/char"
require "chise/kanjilist"
require "chise/defkanji"
require "chise/graphviz"
module CHISE
- class KanjiNetwork #=========================漢字間のネットワークを計算する。
+ class KanjiNetwork # 漢字間のネットワークを計算する
def initialize()
reset()
@formatter = GraphvizFormatter.new(self)
# @formatter = XSpringiesFormatter.new(self)
end
attr_reader :h, :list
+
def reset
@h = Hash.new
@done = Hash.new
@list = []
end
+
def make_network(list) #@h, @listに結果を入れていく。
list.each_char {|ch|
make_network_one(ch)
def out(filename)
open(filename, "w"){|out| out.print to_s }
end
+
def to_s() @formatter.to_s; end
end
- class GraphvizFormatter #======================================== Graphviz関係
+ class GraphvizFormatter # Graphviz関係
def initialize(network)
@network = network
end
+
def to_s() #Graphvizのフォーマット、dotフォーマットに変換する。
page = DotPage.new
page.size = "5.5, 5.5"
end
end
- class XSpringiesFormatter #=================================================
+ class XSpringiesFormatter
def initialize(network)
@network = network
end