Errno::ENOENT when using WordNet::WordNetDB.find
Closed this issue · 6 comments
Seems to work fine for other words, but I've encountered this one which yields problems. Any suggestions?
ruby-1.9.2-p290 >> s = WordNet::WordNetDB.find("stock")
→ [
[0] stock,n,
[1] stock,v,
[2] stock,a
]
ruby-1.9.2-p290 >> s[2].synsets
Errno::ENOENT: No such file or directory - /Users/eric/.rvm/gems/ruby-1.9.2-p290/gems/rwordnet-0.1.3/lib/wordnet/../../WordNet-3.0/dict/data.
from /Users/eric/.rvm/gems/ruby-1.9.2-p290/gems/rwordnet-0.1.3/lib/wordnet/synset.rb:11:in initialize' from /Users/eric/.rvm/gems/ruby-1.9.2-p290/gems/rwordnet-0.1.3/lib/wordnet/synset.rb:11:in
open'
from /Users/eric/.rvm/gems/ruby-1.9.2-p290/gems/rwordnet-0.1.3/lib/wordnet/synset.rb:11:in initialize' from /Users/eric/.rvm/gems/ruby-1.9.2-p290/gems/rwordnet-0.1.3/lib/wordnet/lemma.rb:28:in
new'
from /Users/eric/.rvm/gems/ruby-1.9.2-p290/gems/rwordnet-0.1.3/lib/wordnet/lemma.rb:28:in block in get_synsets' from /Users/eric/.rvm/gems/ruby-1.9.2-p290/gems/rwordnet-0.1.3/lib/wordnet/lemma.rb:28:in
map'
from /Users/eric/.rvm/gems/ruby-1.9.2-p290/gems/rwordnet-0.1.3/lib/wordnet/lemma.rb:28:in get_synsets' from (irb):21 from /Users/eric/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/commands/console.rb:44:in
start'
from /Users/eric/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/commands/console.rb:8:in start' from /Users/eric/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.0.7/lib/rails/commands.rb:23:in
<top (required)>'
from script/rails:6:in require' from script/rails:6:in
ruby-1.9.2-p290 >>
I have a similar problem with the word: "swimming" It blows up where it says, "swimming, a"
I ended up using this: http://words.bighugelabs.com/api.php
Add this line of code and it'll work: WordNet::SynsetType = {"n" => "noun", "v" => "verb", "a" => "adj", "r" => "adv"}
The issue seems to be that lib/wordnet/pos.rb, as installed by ruby gems, erroneously contains:
module WordNet
SynsetType = {"n" => "noun", "v" => "verb", "adj" => "adj", "adv" => "adv"}
end