[Prime-cvs] CVS update: prime/src

Back to archive index

Hiroyuki Komatsu komat****@users*****
2005年 1月 18日 (火) 02:03:59 JST


Index: prime/src/prime-dict-convert.src
diff -u prime/src/prime-dict-convert.src:1.2.4.6 prime/src/prime-dict-convert.src:1.2.4.7
--- prime/src/prime-dict-convert.src:1.2.4.6	Fri Dec 31 05:15:24 2004
+++ prime/src/prime-dict-convert.src	Tue Jan 18 02:03:59 2005
@@ -1,6 +1,6 @@
 #!/usr/bin/env ruby
 # prime-dict-convert: A dictionary converter from a dictionary of another IME
-# $Id: prime-dict-convert.src,v 1.2.4.6 2004/12/30 20:15:24 komatsu Exp $
+# $Id: prime-dict-convert.src,v 1.2.4.7 2005/01/17 17:03:59 komatsu Exp $
 #
 # Copyright (C) 2003 Hiroyuki Komatsu <komat****@taiya*****>
 #     All rights reserved.
@@ -18,6 +18,7 @@
 require 'prime/makedict/dictformat-pubdic'
 require 'prime/makedict/dictformat-cannadic'
 require 'prime/makedict/dictformat-adambnc'
+require 'prime/makedict/dictformat-wordnet'
 require 'prime/makedict/dictformat-usage'
 require 'prime/makedict/basicdict'
 
@@ -49,6 +50,7 @@
                 :skk      => [DictFormatSkkdic],
                 :usage    => [DictFormatUsage],
                 :adambnc  => [DictFormatAdamBNC],
+                :wordnet  => [DictFormatWordNet],
     }
     if FLAG_MECAB then
       @formats[:wordlist] = DictFormatWordlist
@@ -70,7 +72,8 @@
        --skk      :  convert from the skk dict
        --pubdic   :  convert from the pubdic dict
        --usage    :  convert from the usage dict (beta)
-       --adambnc  :  convert from the Adam's BNC word frequency list (beta)
+       --adambnc  :  convert from the Adam\'s BNC word frequency list (beta)
+       --wordnet  :  convert from the WordNet cntlist
        --wordlist :  convert from the wordlist without the readings and POSes
                      (beta)
        --text     :  convert from the plain text file (beta)
@@ -84,7 +87,7 @@
 EOF
   end
 
-  def main ()
+  def main ()  
     parse_options()
 
     if @output_dictname.nil? or @input_dictnames.empty? then
@@ -140,23 +143,19 @@
   def parse_options ()
     options = {}
     parser = GetoptLong.new()
-    parser.set_options(['--help',       '-h',   GetoptLong::NO_ARGUMENT],
-		       ['--version',    '-v',   GetoptLong::NO_ARGUMENT],
-		       ['--debug',      '-d',   GetoptLong::NO_ARGUMENT],
-                       ['--quiet',      '-q',   GetoptLong::NO_ARGUMENT],
-		       ['--append',             GetoptLong::NO_ARGUMENT],
-		       ['--overwrite',          GetoptLong::NO_ARGUMENT],
-		       ['--no-index',           GetoptLong::NO_ARGUMENT],
-		       ['--prime',              GetoptLong::REQUIRED_ARGUMENT],
-		       ['--canna',              GetoptLong::REQUIRED_ARGUMENT],
-		       ['--skk',                GetoptLong::REQUIRED_ARGUMENT],
-		       ['--pubdic',             GetoptLong::REQUIRED_ARGUMENT],
-		       ['--usage',            GetoptLong::REQUIRED_ARGUMENT],
-		       ['--adambnc',            GetoptLong::REQUIRED_ARGUMENT],
-		       ['--wordlist',           GetoptLong::REQUIRED_ARGUMENT],
-		       ['--text',               GetoptLong::REQUIRED_ARGUMENT],
-		       ['--gaim',               GetoptLong::REQUIRED_ARGUMENT]
-		       )
+    option_list = [
+      ['--help',       '-h',   GetoptLong::NO_ARGUMENT],
+      ['--version',    '-v',   GetoptLong::NO_ARGUMENT],
+      ['--debug',      '-d',   GetoptLong::NO_ARGUMENT],
+      ['--quiet',      '-q',   GetoptLong::NO_ARGUMENT],
+      ['--append',             GetoptLong::NO_ARGUMENT],
+      ['--overwrite',          GetoptLong::NO_ARGUMENT],
+      ['--no-index',           GetoptLong::NO_ARGUMENT],
+    ]
+    @formats.keys.each { | key |
+      option_list.push( ['--' + key.to_s(), GetoptLong::REQUIRED_ARGUMENT] )
+    }
+    parser.set_options(*option_list)
 
     parser.each_option {|option, arg|
       options[option.sub(/^--/, '')] = arg


Prime-cvs メーリングリストの案内
Back to archive index