Kouhei Sutou
kous****@users*****
2006年 11月 30日 (木) 18:15:32 JST
Index: tomoe/utils/xml2est.rb diff -u /dev/null tomoe/utils/xml2est.rb:1.1 --- /dev/null Thu Nov 30 18:15:31 2006 +++ tomoe/utils/xml2est.rb Thu Nov 30 18:15:31 2006 @@ -0,0 +1,25 @@ +#!/usr/bin/env ruby + +benchmark_dir = File.expand_path(File.dirname(__FILE__)) +top_dir = File.expand_path(File.join(benchmark_dir, "..")) +test_dir = File.join(top_dir, "test") +$LOAD_PATH.unshift(File.join(top_dir, "ext", "ruby", ".libs")) +$LOAD_PATH.unshift(File.join(top_dir, "ext", "ruby")) +$LOAD_PATH.unshift(File.join(test_dir)) + +require "tomoe-spec-utils" + +TomoeSpecUtils::Config.dictionaries.sort.each do |dictionary| + print "converting #{dictionary}..." + est_db_name = dictionary.sub(/\.xml$/, "") + xml_dict = Tomoe::Dict.new("xml", + "filename" => dictionary, + "editable" => false) + est_dict = Tomoe::Dict.new("est", + "database_name" => est_db_name, + "editable" => true) + xml_dict.search(Tomoe::Query.new).each do |cand| + est_dict.register(cand.char) + end + puts "done." +end