Changeset 87 for trunk/convertdb.rb
- Timestamp:
- 07/08/08 08:07:04 (6 months ago)
- Location:
- trunk
- Files:
-
- 2 modified
-
. (modified) (1 prop)
-
convertdb.rb (modified) (4 diffs, 1 prop)
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 4 4 Ruby-WordNet-* 5 5 commit-msg.txt 6 WordNet-*
-
- Property svn:ignore
-
trunk/convertdb.rb
- Property svn:keywords changed from author date id revision to Date Rev Author URL Id
r86 r87 75 75 # Temporary location for the lexicon data files 76 76 BuildDir = Pathname.new( __FILE__ ).expand_path.dirname + 77 Pathname.new( WordNet::Lexicon::D efaultDbEnv).basename77 Pathname.new( WordNet::Lexicon::DEFAULT_DB_ENV ).basename 78 78 79 79 … … 90 90 "used by Ruby-WordNet. This will not affect existing WordNet files,\n"\ 91 91 "but will require up to 40Mb of disk space.\n" 92 exit unless /^y/i =~ prompt WithDefault("Continue?", "y")92 exit unless /^y/i =~ prompt_with_default("Continue?", "y") 93 93 94 94 # Open the database and check to be sure it's empty. Confirm overwrite if … … 98 98 "will be overwritten.\n" 99 99 abort( "user cancelled." ) unless 100 /^y/i =~ prompt WithDefault( "Continue?", "n" )100 /^y/i =~ prompt_with_default( "Continue?", "n" ) 101 101 BuildDir.rmtree 102 102 end … … 104 104 # Find the source data files 105 105 if ARGV.empty? 106 default = nil 107 108 if wndirs = Pathname.glob( Pathname.getwd + 'WordNet-*' ) 109 default = wndirs.first 110 else 111 default = '/usr/local/WordNet-3.0' 112 end 106 113 107 114 # :TODO: Do some more intelligent searching here 108 115 message "Where can I find the WordNet data files?\n" 109 datadir = prompt WithDefault( "Data directory", "/usr/local/WordNet-2.1/dict" )116 datadir = prompt_with_default( "Data directory", default + "dict" ) 110 117 else 111 118 datadir = ARGV.shift 112 119 end 113 114 abort( "Directory '#{datadir}' does not exist" ) unless File::exists?( datadir ) 115 abort( " '#{datadir}' is not a directory" ) unless File::directory?( datadir )116 testfile = File::join(datadir, "data.noun")117 abort( "'#{datadir}' doesn't seem to contain the necessary files.") unless118 File::exists?( testfile )120 datadir = Pathname.new( datadir ) 121 122 abort( "Directory '#{datadir}' does not exist" ) unless datadir.exist? 123 abort( "'#{datadir}' is not a directory" ) unless datadir.directory? 124 testfile = datadir + "data.noun" 125 abort( "'#{datadir}' doesn't seem to contain the necessary files.") unless testfile.exist? 119 126 120 127 # Open the lexicon readwrite into the temporary datadir
