X-Git-Url: http://git.chise.org/gitweb/?p=chise%2Fruby.git;a=blobdiff_plain;f=chise%2Fids.rb;fp=chise%2Fids.rb;h=7041073bda969c05673e5ff1f0500db466d42de6;hp=0ccb8d621f8c1819d7a4d2cddbd953230baaac13;hb=ba667bdcece8aa4398265e40e94e35349504aada;hpb=977b521e92a8c084161225ab7a624f3c7026fa11 diff --git a/chise/ids.rb b/chise/ids.rb index 0ccb8d6..7041073 100755 --- a/chise/ids.rb +++ b/chise/ids.rb @@ -29,50 +29,6 @@ module CHISE IDC_SURROUND_FROM_LOWER_LEFT = IDC_A IDC_OVERLAID = IDC_B - class Nu_IDS - def initialize(ids) - @ids = ids - @ids.freeze - end - - def tree() IDS_Tree.new(@ids); end - - def compose(dbname="ids") - ids = @ids.to_ids.aggregate - - cd = ChiseDB.instance - byidsdb = cd.get_by_ids_db(dbname) - cid = byidsdb.decode(ids) - return "" if cid.nil? # TO CHECK: why "", not nil? - composed = Character.get(cid).to_s - return "" if composed.nil? - return "" if composed.char_length == 0 - return composed if composed.char_length == 1 - composed.each_char {|ch| - char = ch.char - #return ch if char.has_attribute? - return ch # TO CHECK: the first character? - } - return "" - end - - def aggregate(dbname="ids") - # In each sub part of IDS, search the corresponding char_id. - # If you could search the corresponding char_id, substitute with it. - tree = self.tree - return @ids if tree.depth <= 1 # no sub_node - tree.sub_nodes.each {|node| - c = node.to_ids.compose(dbname) - next if c.nil? || c == "" - # print "#{@ids} #{node} #{c}\n" - # p [@ids, node, c] - n = @ids.gsub(node, c) - return n.to_ids.aggregate(dbname) - } - @ids - end - end - module StringIDS def decompose map_char {|ch| ch.char.decompose } @@ -104,7 +60,8 @@ module CHISE def aggregate(dbname="ids") # In each sub part of IDS, search the corresponding char_id. # If you could search the corresponding char_id, substitute with it. - tree = self.ids_tree + #tree = self.ids_tree + tree = IDS_Tree.new(self) return self if tree.depth <= 1 # no sub_node tree.sub_nodes.each {|node| c = node.compose(dbname)