From: hemant Date: 2007-07-22T12:36:03+09:00 Subject: Re: Problems with test cases and other things with Ruby-WordNet On 7/21/07, H H wrote: > I tried to post this as a ticket to Ruby-WordNet trac as a ticket but > it kept rejecting it as "Possible Spam" so here it. (For those of you > having problems running convertdb.rb and core dumps - jump to the end) > > Ubuntu 7.04 > ruby 1.8.5 (2006-08-25) [i486-linux] > WordNet-3.0 > ------------------ > After much heartache I was able to successfully install Ruby WordNet > but some of the tests fail at the end when running 'ruby test.rb'. I > am able to load up the library from Linguistics as well as separately > using require 'wordnet', but all commands bring back nil values. The > pre-packaged download does not let me run the test.rb at all as it > returns: > > ./tests/wntestcase.rb:57:in `require': no such file to load -- test/ > unit/mock (LoadError) > from ./tests/wntestcase.rb:57 > from test.rb:15:in `require' > from test.rb:15 > from ./utils.rb:665:in `verboseOff' > from test.rb:14 > > I tried installing the Test::Unit::Mock library but didn't get very > far. I checked out the latest source code from SVN using: > > svn checkout svn://deveiate.org/Ruby-WordNet/trunk > > I was able to run the tests using this revision. After successfully > converting the WordNet data files - I ran ruby test.rb and received > the following errors: > ------------- > 0 patterns given on the command line > Required 3 files. > Loaded suite WordNet > Started > ..FF...FF.E.F...FFFFFFFFF > Finished in 0.787878 seconds. > > 1) Failure: > test_familiarity_for_testwords_should_all_return_a_fixnum(LexiconTests) > [./tests/lexicon.tests.rb:92:in > `test_familiarity_for_testwords_should_all_return_a_fixnum' > ./tests/lexicon.tests.rb:88:in `each' > ./tests/lexicon.tests.rb:88:in > `test_familiarity_for_testwords_should_all_return_a_fixnum' > ./tests/wntestcase.rb:141:in `run']: > expected to be an instance of > but was > . > > 2) Failure: > test_grep_finds_compound_words(LexiconTests) > [./tests/lexicon.tests.rb:137:in `test_grep_finds_compound_words' > ./tests/wntestcase.rb:141:in `run']: > Exception raised: > Class: > Message: <"undefined method `[]' for nil:NilClass"> > ---Backtrace--- > ./lib/wordnet/lexicon.rb:278:in `grep' > ./tests/lexicon.tests.rb:138:in `test_grep_finds_compound_words' > ./tests/lexicon.tests.rb:137:in `test_grep_finds_compound_words' > ./tests/wntestcase.rb:141:in `run' > --------------- > > 3) Failure: > test_lookup_synsets(LexiconTests) > [./tests/lexicon.tests.rb:156:in `test_lookup_synsets' > ./tests/lexicon.tests.rb:151:in `each' > ./tests/lexicon.tests.rb:151:in `test_lookup_synsets' > ./tests/wntestcase.rb:141:in `run']: > expected to be an instance of > but was > . > > 4) Failure: > test_morphology_of_dictionary_word_should_return_root_word(LexiconTests) > [./tests/lexicon.tests.rb:104:in > `test_morphology_of_dictionary_word_should_return_root_word' > ./tests/wntestcase.rb:141:in `run']: > <"angry"> expected but was > . > > 5) Error: > test_perl_tests(LexiconTests): > WordNet::LookupError: Failed lookup of synset '00466621%n':No such > synset > ./lib/wordnet/lexicon.rb:239:in `lookup_synsets_by_key' > ./lib/wordnet/lexicon.rb:238:in `each' > ./lib/wordnet/lexicon.rb:238:in `lookup_synsets_by_key' > ./tests/linguawordnet.tests.rb:17:in `test_perl_tests' > ./tests/wntestcase.rb:141:in `run' > > 6) Failure: > test_reverse_morphology_should_return_inverse(LexiconTests) > [./tests/lexicon.tests.rb:129:in > `test_reverse_morphology_should_return_inverse' > ./tests/wntestcase.rb:141:in `run']: > expected to be =~ > . > > 7) Failure: > test_hyponym_traversal_with_no_block_and_false_second_arg_should_return_holonyms_but_not_the_origin(SynsetTests) > [./tests/synset.tests.rb:208:in > `test_hyponym_traversal_with_no_block_and_false_second_arg_should_return_holonyms_but_not_the_origin' > ./tests/wntestcase.rb:141:in `run']: > Exception raised: > Class: > Message: <"undefined method `traverse' for nil:NilClass"> > ---Backtrace--- > ./tests/synset.tests.rb:209:in > `test_hyponym_traversal_with_no_block_and_false_second_arg_should_return_holonyms_but_not_the_origin' > ./tests/synset.tests.rb:208:in > `test_hyponym_traversal_with_no_block_and_false_second_arg_should_return_holonyms_but_not_the_origin' > ./tests/wntestcase.rb:141:in `run' > --------------- > > 8) Failure: > test_hyponym_traversal_with_no_block_should_return_appropriate_hyponyms(SynsetTests) > [./tests/synset.tests.rb:192:in > `test_hyponym_traversal_with_no_block_should_return_appropriate_hyponyms' > ./tests/wntestcase.rb:141:in `run']: > Exception raised: > Class: > Message: <"undefined method `traverse' for nil:NilClass"> > ---Backtrace--- > ./tests/synset.tests.rb:193:in > `test_hyponym_traversal_with_no_block_should_return_appropriate_hyponyms' > ./tests/synset.tests.rb:192:in > `test_hyponym_traversal_with_no_block_should_return_appropriate_hyponyms' > ./tests/wntestcase.rb:141:in `run' > --------------- > > 9) Failure: > test_part_of_speech_should_return_the_symbol_part_of_speech(SynsetTests) > [./tests/synset.tests.rb:243:in > `test_part_of_speech_should_return_the_symbol_part_of_speech' > ./tests/wntestcase.rb:141:in `run']: > Exception raised: > Class: > Message: <"undefined method `part_of_speech' for nil:NilClass"> > ---Backtrace--- > ./tests/synset.tests.rb:243:in > `test_part_of_speech_should_return_the_symbol_part_of_speech' > ./tests/synset.tests.rb:243:in > `test_part_of_speech_should_return_the_symbol_part_of_speech' > ./tests/wntestcase.rb:141:in `run' > --------------- > > 10) Failure: > test_pos_should_return_the_synsets_singlechar_part_of_speech(SynsetTests) > [./tests/synset.tests.rb:253:in > `test_pos_should_return_the_synsets_singlechar_part_of_speech' > ./tests/wntestcase.rb:141:in `run']: > Exception raised: > Class: > Message: <"undefined method `pos' for nil:NilClass"> > ---Backtrace--- > ./tests/synset.tests.rb:253:in > `test_pos_should_return_the_synsets_singlechar_part_of_speech' > ./tests/synset.tests.rb:253:in > `test_pos_should_return_the_synsets_singlechar_part_of_speech' > ./tests/wntestcase.rb:141:in `run' > --------------- > > 11) Failure: > test_relations(SynsetTests) > [./tests/synset.tests.rb:108:in `test_relations' > ./tests/synset.tests.rb:105:in `each' > ./tests/synset.tests.rb:105:in `test_relations' > ./tests/wntestcase.rb:141:in `run']: > <#> > of type > expected to respond_to?<:instance_hyponyms>. > > 12) Failure: > test_synset_should_respond_to_traverse_method(SynsetTests) > [./tests/synset.tests.rb:138:in > `test_synset_should_respond_to_traverse_method' > ./tests/wntestcase.rb:141:in `run']: > > of type > expected to respond_to?<:traverse>. > > 13) Failure: > test_traversal_break_after_3_should_include_three_sets_plus_origin(SynsetTests) > [./tests/synset.tests.rb:225:in > `test_traversal_break_after_3_should_include_three_sets_plus_origin' > ./tests/wntestcase.rb:141:in `run']: > Exception raised: > Class: > Message: <"undefined method `traverse' for nil:NilClass"> > ---Backtrace--- > ./tests/synset.tests.rb:226:in > `test_traversal_break_after_3_should_include_three_sets_plus_origin' > ./tests/synset.tests.rb:225:in > `test_traversal_break_after_3_should_include_three_sets_plus_origin' > ./tests/wntestcase.rb:141:in `run' > --------------- > > 14) Failure: > test_traversal_with_false_second_arg_should_not_include_origin(SynsetTests) > [./tests/synset.tests.rb:172:in > `test_traversal_with_false_second_arg_should_not_include_origin' > ./tests/wntestcase.rb:141:in `run']: > Exception raised: > Class: > Message: <"undefined method `traverse' for nil:NilClass"> > ---Backtrace--- > ./tests/synset.tests.rb:173:in > `test_traversal_with_false_second_arg_should_not_include_origin' > ./tests/synset.tests.rb:172:in > `test_traversal_with_false_second_arg_should_not_include_origin' > ./tests/wntestcase.rb:141:in `run' > --------------- > > 15) Failure: > test_traversal_with_true_second_arg_should_include_origin(SynsetTests) > [./tests/synset.tests.rb:149:in > `test_traversal_with_true_second_arg_should_include_origin' > ./tests/wntestcase.rb:141:in `run']: > Exception raised: > Class: > Message: <"undefined method `traverse' for nil:NilClass"> > ---Backtrace--- > ./tests/synset.tests.rb:150:in > `test_traversal_with_true_second_arg_should_include_origin' > ./tests/synset.tests.rb:149:in > `test_traversal_with_true_second_arg_should_include_origin' > ./tests/wntestcase.rb:141:in `run' > --------------- > > 25 tests, 116 assertions, 14 failures, 1 errors > --------------- > > sudo ruby install.rb appears to work - but when using the library in a > ruby program nil values are returned. > > sudo irb > > require 'wordnet' > lex = WordNet::Lexicon::new > lex.lookup_synsets("shoe", WordNet::Noun) > => nil > > I'm not sure what I've done wrong up to this point. Hopefully the > information I've provided can show it's something wrong on my end. > > For those of you looking for the instructions to get you to the point > where you can run the installation tests, I've provided the KEY steps > here for installation on Ubuntu 7.04: > > #Download Berkeley DB from Oracle (MUST BE 4.4 or earlier!) > wget http://download.oracle.com/berkeley-db/db-4.4.20.tar.gz #untar > and install per INSTALL file instructions > > #Get the ruby bindings for BDB (MUST BE VERSION 0.6.0 - I had core > dumps with using any other binding during the convertdb command) > wget ftp://moulon.inra.fr/pub/ruby/bdb-0.6.0.tar.gz > > #when compiling the bindings point to the proper headers > ruby extconf.rb --with-db-include=/home/johndoe/db-4.4.20/build_unix > make > sudo make install > > svn checkout svn://deveiate.org/Ruby-WordNet/trunk > ruby convertdb.rb /home/johndoe/WordNet-3.0/dict/ > > Any information or help in getting the test and the wordnet library to > work - would be greatly appreciated. Perhaps a brave soul can make a > gem out of it... > Henry, So far my experience with Ruby bindings for wordnet is, its stinking piece of shit. Its about time someone took ownership of this project and do something about it. I know I am not helping you much, but NLP is the one thing that makes me jealous of pythonists.