- edited description
-
assigned issue to
#3 SQLite3::SQLException: no such table: synsets
I am newbie on ruby which just complete install "wordnet-defaultdb" gem and execute in irb
here is the code
DL is deprecated, please use Fiddle irb(main):001:0> require 'wordnet' => true irb(main):002:0> w=WordNet::Lexicon.new => #<WordNet::Lexicon:0x2a15278 sqlite:C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/w ordnet-defaultdb-1.0.1/data/wordnet-defaultdb/wordnet30.sqlite> irb(main):003:0> w[:shoe] [2013-12-08 00:49:12.278144 3504/main] error {} -- SQLite3::SQLException: no suc h table: synsets: SELECT * FROM `synsets` WHERE (`synsets`.`synsetid` IN (SELECT `senses`.`synsetid` FROM `senses` WHERE ((`senses`.`wordid` IN (SELECT `words`. `wordid` FROM `words` WHERE ((`lemma` = 'shoe') AND (`words`.`wordid` IS NOT NUL L)))) AND (`senses`.`synsetid` IS NOT NULL)))) LIMIT 1 OFFSET 0 Sequel::DatabaseError: SQLite3::SQLException: no such table: synsets from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.8-x64-mingw32/l ib/sqlite3/database.rb:91:in `initialize' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.8-x64-mingw32/l ib/sqlite3/database.rb:91:in `new' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.8-x64-mingw32/l ib/sqlite3/database.rb:91:in `prepare' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.8-x64-mingw32/l ib/sqlite3/database.rb:263:in `query' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sequel-3.48.0/lib/sequel/ad apters/sqlite.rb:179:in `block (2 levels) in _execute' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sequel-3.48.0/lib/sequel/da tabase/logging.rb:37:in `log_yield' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sequel-3.48.0/lib/sequel/ad apters/sqlite.rb:179:in `block in _execute' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sequel-3.48.0/lib/sequel/da tabase/connecting.rb:235:in `block in synchronize' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sequel-3.48.0/lib/sequel/co nnection_pool/threaded.rb:104:in `hold' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sequel-3.48.0/lib/sequel/da tabase/connecting.rb:235:in `synchronize' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sequel-3.48.0/lib/sequel/ad apters/sqlite.rb:172:in `_execute' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sequel-3.48.0/lib/sequel/ad apters/sqlite.rb:122:in `execute' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sequel-3.48.0/lib/sequel/da taset/actions.rb:860:in `execute' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sequel-3.48.0/lib/sequel/ad apters/sqlite.rb:350:in `fetch_rows' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sequel-3.48.0/lib/sequel/da taset/actions.rb:154:in `each' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sequel-3.48.0/lib/sequel/da taset/actions.rb:57:in `all' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/wordnet-1.0.0/lib/wordnet/l exicon.rb:324:in `lookup_synsets' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/wordnet-1.0.0/lib/wordnet/l exicon.rb:255:in `[]' from (irb):3 from C:/Ruby200-x64/bin/irb:12:in `<main>'irb(main):004:0> }}}
Comments (9)
-
-
Hi Michael Granger
Thanks for the feedback. I try it and as what you expect, it is empty.
irb(main):001:0> require 'wordnet' => true irb(main):002:0> w=WordNet::Lexicon.new => #<WordNet::Lexicon:0x36a008 sqlite:C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/ 1.9.1/gems/wordnet-defaultdb-1.0.1/data/wordnet-defaultdb/wordnet30.sqlite> irb(main):003:0> w.db.tables => [] irb(main):004:0>
I did check the directory and it show 63mb sqlite file exist in the path. I just not really sure why the it can't be detected.
Any suggestion on this?
Thanks
-
Same issue on windows. Attempted pretty much every solution I could find, but to no avail.
-
In a previous issue, the problem was that rwordnet was still installed. I've uninstalled it and tried pointing to the sqlite3 database directly, but still have the behavior mentioned earlier: the wordnet30.sqlite file exists and is non-empty, but WordNet::Lexicon.new.db.tables returns an empty list.
-
Hi all,
If you're not able to see the tables in the default Sqlite DB, try accessing it using the
sqlite3
tool that should have come with your Sqlite installation. On my box this looks like:From irb/pry:
[1] pry(main)> lex = WordNet::Lexicon.new [snip] => #<WordNet::Lexicon:0x7fa443221278 sqlite:/Users/ged/.rvm/gems/ruby-2.2.2@faeriemud/gems/wordnet-defaultdb-1.0.1/data/wordnet-defaultdb/wordnet30.sqlite>
Then take the path from the Lexicon, and run
sqlite3
on it and run the.tables
command to dump the list of tables in the DB:$ sqlite3 /Users/ged/.rvm/gems/ruby-2.2.2@faeriemud/gems/wordnet-defaultdb-1.0.1/data/wordnet-defaultdb/wordnet30.sqlite SQLite version 3.8.5 2014-08-15 22:37:57 Enter ".help" for usage hints. sqlite> .tables adjpositions linktypes semlinks vframesentencemaps adjpositiontypes morphmaps senses vframesentences casedwords morphs synsets words lexdomains postypes vframemaps lexlinks samples vframes
If your DB shows the same thing, we at least know that the data is there in a format your machine can understand. If not, I may be packaging the database in the gem wrong somehow, especially for non-*NIX platforms.
-
Thanks for the quick response! Yes, I have them. Some quick tests for reasonableness:
select count(*) from words; select count(*) from semlinks; select count(*) from synsets s join lexdomains d on s.lexdomainid = d.lexdomainid where definition like "%mountain%"
gives 147,306, 285,348, and 409 entries respectively.
I also tried uninstalling WordNet 2.1 downloaded from Princeton (and reinstalled the Ruby-Wordnet gem), but that had no impact.
-
Hi I'm using windows 7 and having the same issue Is there any solution yet?
-
@Duy Nguyễn No, I've yet to be able to replicate this, so I don't have a solution unfortunately. :/
-
I just tried this again to be sure; here's my session:
bsdhost $ pry [1] pry(main)> require 'wordnet' LoadError: cannot load such file -- wordnet from /usr/local/lib/ruby/site_ruby/2.3/rubygems/core_ext/kernel_require.rb:55:in `require' [2] pry(main)> ^D bsdhost $ sudo gem install wordnet --no-ri --no-rdoc Fetching: sequel-4.42.1.gem (100%) Successfully installed sequel-4.42.1 Fetching: wordnet-1.0.1.gem (100%) If you don't already have a WordNet database installed somewhere, you'll need to either download and install one from: http://wnsql.sourceforge.net/ or just install the 'wordnet-defaultdb' gem, which will install the SQLite version for you. Successfully installed wordnet-1.0.1 2 gems installed bsdhost $ pry [1] pry(main)> require 'wordnet' => true [2] pry(main)> lex = WordNet::Lexicon.new [2017-01-23 15:48:13.803618 95221/main] warn {WordNet::Lexicon} -- no defaultdb gem; looking for the development database WordNet::LexiconError: No default WordNetSQL database! You can install it via the wordnet-defaultdb gem, or download a version yourself from http://sourceforge.net/projects/wnsql/ from /usr/local/lib/ruby/gems/2.3/gems/wordnet-1.0.1/lib/wordnet/lexicon.rb:189:in `initialize_with_defaultdb' [3] pry(main)> ^D bsdhost $ sudo gem install wordnet-defaultdb --no-ri --no-rdoc Fetching: wordnet-defaultdb-1.0.1.gem (100%) Successfully installed wordnet-defaultdb-1.0.1 1 gem installed bsdhost $ pry [1] pry(main)> require 'wordnet' => true [2] pry(main)> lex = WordNet::Lexicon.new => #<WordNet::Lexicon:0x805558b30 sqlite:/usr/local/lib/ruby/gems/2.3/gems/wordnet-defaultdb-1.0.1/data/wordnet-defaultdb/wordnet30.sqlite> [3] pry(main)> lex.db.tables => [:adjpositions, :adjpositiontypes, :casedwords, :lexdomains, :lexlinks, :linktypes, :morphmaps, :morphs, :postypes, :samples, :semlinks, :senses, :synsets, :vframemaps, :vframes, :vframesentencemaps, :vframesentences, :words] [4] pry(main)> lex[:shoe] => #<WordNet::Synset:0x805668610 {102890940} 'brake shoe, shoe, skid' (noun): [noun.artifact] a restraint provided when the brake linings are moved hydraulically against the brake drum to retard the wheel's rotation> [5] pry(main)> ^D
If anyone has a way to reproduce this, I'd be happy to fix whatever the issue is, but I'm at a loss beyond something like permissions problems or other things outside of the gem's control.
- Log in to comment
Well, that's no good.
The Lexicon is clearly pointing at the database included with the defaultdb gem, so I don't know why it can't see the synsets table.
Can you do me a favor and run the following in an IRB session?
That should output a list of tables like:
I'm assuming it won't in your case, but I want to ensure it's actually a data problem, and not a code problem.
If that is indeed empty, can you look at the database file (
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/wordnet-defaultdb-1.0.1/data/wordnet-defaultdb/wordnet30.sqlite
) and ensure that it's around 60M in size?That'll tell us whether it was the download that was the problem, or if there's something else going on. I've never run the library on a Windows machine, so I might have screwed something up with regard to the path to the default database or something.
I'll also try testing it on my Windows box to see if I can spot any trouble.
Thanks for reporting this!