Changeset 87 for trunk/convertdb.rb

Show
Ignore:
Timestamp:
07/08/08 08:07:04 (6 months ago)
Author:
deveiant
Message:

Checkpoint commit:

  • started work on integrating dict conversion into the Rakefile. Not quite done yet.
  • removed the coverage check from the svn:ci task until I get all the specs converted.
  • started cleaning up the distribution
  • updated the included bdb library to the latest release
  • added support for conversion of the dict files directly from a WordNet?-x.x.tar.bz2 tarball extracted in the top-level directory
Location:
trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        44Ruby-WordNet-* 
        55commit-msg.txt 
         6WordNet-* 
  • trunk/convertdb.rb

    • Property svn:keywords changed from author date id revision to Date Rev Author URL Id
    r86 r87  
    7575# Temporary location for the lexicon data files 
    7676BuildDir = Pathname.new( __FILE__ ).expand_path.dirname +  
    77            Pathname.new( WordNet::Lexicon::DefaultDbEnv ).basename 
     77           Pathname.new( WordNet::Lexicon::DEFAULT_DB_ENV ).basename 
    7878 
    7979 
     
    9090        "used by Ruby-WordNet. This will not affect existing WordNet files,\n"\ 
    9191        "but will require up to 40Mb of disk space.\n" 
    92     exit unless /^y/i =~ promptWithDefault("Continue?", "y") 
     92    exit unless /^y/i =~ prompt_with_default("Continue?", "y") 
    9393 
    9494    # Open the database and check to be sure it's empty. Confirm overwrite if 
     
    9898            "will be overwritten.\n" 
    9999        abort( "user cancelled." ) unless  
    100             /^y/i =~ promptWithDefault( "Continue?", "n" ) 
     100            /^y/i =~ prompt_with_default( "Continue?", "n" ) 
    101101        BuildDir.rmtree 
    102102    end 
     
    104104    # Find the source data files 
    105105    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 
    106113 
    107114        # :TODO: Do some more intelligent searching here 
    108115        message "Where can I find the WordNet data files?\n" 
    109         datadir = promptWithDefault( "Data directory", "/usr/local/WordNet-2.1/dict" ) 
     116        datadir = prompt_with_default( "Data directory", default + "dict" ) 
    110117    else 
    111118        datadir = ARGV.shift 
    112119    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.") unless 
    118         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? 
    119126 
    120127    # Open the lexicon readwrite into the temporary datadir