louismullie / treat

Natural language processing framework for Ruby.
Other
1.36k stars 128 forks source link

unable to parse #74

Open borgr opened 10 years ago

borgr commented 10 years ago

hello, I have been trying to install and use treat, but when I try parsing, I get the following error:

irb(main):008:0> s = sentence('this is another test').parse LoadError: cannot load such file -- stanford-core-nlp from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:i n require' from C:/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:i nrequire' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/treat-2.0.7/lib/treat/loaders/s tanford.rb:7:in load' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/treat-2.0.7/lib/treat/workers/p rocessors/parsers/stanford.rb:24:inparse' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/treat-2.0.7/lib/treat/entities/ entity/delegatable.rb:66:in call_worker' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/treat-2.0.7/lib/treat/entities/ entity/delegatable.rb:40:inblock (2 levels) in add_workers' from (irb):8 from C:/Ruby193/bin/irb:12:in `

'

I have also tried to reinstall the english package which finished but also written many errors among them:

c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2/libstdc++.dll.a(d00 3873.o):(.text+0x0): first defined here c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2\libstdc++.a(eh_thro w.o):eh_throw.cc:(.text+0xd0): multiple definition of __cxa_rethrow' c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2/libstdc++.dll.a(d00 3883.o):(.text+0x0): first defined here c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2\libstdc++.a(eh_pers onality.o):eh_personality.cc:(.text+0x34c): multiple definition of__gxx_person ality_sj0' c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2/libstdc++.dll.a(d00 3897.o):(.text+0x0): first defined here collect2: ld returned 1 exit status make: *\ [word_tagger.so] Error 1

any idea what am I doing wrong? or what is the problem? thank you in advance

louismullie commented 10 years ago

Can you try gem install stanford-core-nlp, manually adding the JAR files (as described on the stanford-core-nlp gem's home page) and then running your parse example again?

borgr commented 10 years ago

apparently jdk is needed and all kinds of java stuff which were not mentioned anywhere in the installing or the dependency list. I did the following and got the stanford installed this time (although there is still a problem, it looks like it was a needed step:

So basically, the issue is missing rjb and JAVA_HOME environment variable. Here are the notes I took after I was finally able to resolve all these issues:

install ruby + gem [rubyinstaller for windows, install the devKit as well] - this part is already done make sure you have Java JDK installed. if using ruby 1.9.3 - YOU MUST HAVE JDK for 32 BIT installed add the 'JAVA_HOME' environment variable to your JDK folder [32 BIT!!] [Computer -> Properties -> Advanced System Settings -> Environment variables -> New] gem install rjb gem install treat [it installs many dependency gems] Treat::Core::Installer.install 'english' [also installing dependency gems, including the stanford etc]

after this the missing stanfrod error stopped showing up, in the Treat::Core::Installer.install 'english' process there were still many wierd errors as followed:

porter_stemmer.c:303:14: warning: passing argument 2 of 'ends' discards qualifie rs from pointer target type porterstemmer.c:170:12: note: expected 'char ' but argument is of type 'const char ' porter_stemmer.c:303:14: warning: passing argument 2 of 'r' discards qualifiers from pointer target type porter_stemmer.c:193:13: note: expected 'char ' but argument is of type 'const char ' porter_stemmer.c:305:4: warning: passing argument 2 of 'ends' discards qualifier s from pointer target type porter_stemmer.c:170:12: note: expected 'char ' but argument is of type 'const char ' porter_stemmer.c:305:4: warning: passing argument 2 of 'r' discards qualifiers f rom pointer target type porter_stemmer.c:193:13: note: expected 'char ' but argument is of type 'const char ' porter_stemmer.c: In function 'step4': porter_stemmer.c:313:4: warning: passing argument 2 of 'ends' discards qualifier s from pointer target type porter_stemmer.c:170:12: note: expected 'char ' but argument is of type 'const char ' porter_stemmer.c:314:7: warning: passing argument 2 of 'ends' discards qualifier s from pointer target type porter_stemmer.c:170:12: note: expected 'char ' but argument is of type 'const char ' porter_stemmer.c:315:17: warning: passing argument 2 of 'ends' discards qualifie rs from pointer target type porter_stemmer.c:170:12: note: expected 'char ' but argument is of type 'const char ' porter_stemmer.c:316:7: warning: passing argument 2 of 'ends' discards qualifier s from pointer target type porter_stemmer.c:170:12: note: expected 'char ' but argument is of type 'const char ' porter_stemmer.c:317:7: warning: passing argument 2 of 'ends' discards qualifier s from pointer target type porter_stemmer.c:170:12: note: expected 'char ' but argument is of type 'const char ' porter_stemmer.c:318:7: warning: passing argument 2 of 'ends' discards qualifier s from pointer target type porter_stemmer.c:170:12: note: expected 'char ' but argument is of type 'const char ' porter_stemmer.c:319:17: warning: passing argument 2 of 'ends' discards qualifie rs from pointer target type porter_stemmer.c:170:12: note: expected 'char ' but argument is of type 'const char ' porter_stemmer.c:320:7: warning: passing argument 2 of 'ends' discards qualifier s from pointer target type porter_stemmer.c:170:12: note: expected 'char ' but argument is of type 'const char ' porter_stemmer.c:321:17: warning: passing argument 2 of 'ends' discards qualifie rs from pointer target type porter_stemmer.c:170:12: note: expected 'char ' but argument is of type 'const char ' porter_stemmer.c:322:17: warning: passing argument 2 of 'ends' discards qualifie rs from pointer target type porter_stemmer.c:170:12: note: expected 'char ' but argument is of type 'const char ' porter_stemmer.c:323:17: warning: passing argument 2 of 'ends' discards qualifie rs from pointer target type porter_stemmer.c:170:12: note: expected 'char ' but argument is of type 'const char ' porter_stemmer.c:324:7: warning: passing argument 2 of 'ends' discards qualifier s from pointer target type porter_stemmer.c:170:12: note: expected 'char ' but argument is of type 'const char ' porter_stemmer.c:325:17: warning: passing argument 2 of 'ends' discards qualifie rs from pointer target type porter_stemmer.c:170:12: note: expected 'char ' but argument is of type 'const char ' porter_stemmer.c:327:7: warning: passing argument 2 of 'ends' discards qualifier s from pointer target type porter_stemmer.c:170:12: note: expected 'char ' but argument is of type 'const char ' porter_stemmer.c:328:7: warning: passing argument 2 of 'ends' discards qualifier s from pointer target type porter_stemmer.c:170:12: note: expected 'char ' but argument is of type 'const char ' porter_stemmer.c:329:17: warning: passing argument 2 of 'ends' discards qualifie rs from pointer target type porter_stemmer.c:170:12: note: expected 'char ' but argument is of type 'const char ' porter_stemmer.c:330:7: warning: passing argument 2 of 'ends' discards qualifier s from pointer target type porter_stemmer.c:170:12: note: expected 'char ' but argument is of type 'const char ' porter_stemmer.c:331:7: warning: passing argument 2 of 'ends' discards qualifier s from pointer target type porter_stemmer.c:170:12: note: expected 'char ' but argument is of type 'const char ' porter_stemmer.c:332:7: warning: passing argument 2 of 'ends' discards qualifier s from pointer target type porter_stemmer.c:170:12: note: expected 'char ' but argument is of type 'const char ' compiling rtagger.cc cc1plus.exe: warning: command line option "-Wdeclaration-after-statement" is val id for C/ObjC but not for C++ cc1plus.exe: warning: command line option "-Wimplicit-function-declaration" is v alid for C/ObjC but not for C++ compiling tagger.cc cc1plus.exe: warning: command line option "-Wdeclaration-after-statement" is val id for C/ObjC but not for C++ cc1plus.exe: warning: command line option "-Wimplicit-function-declaration" is v alid for C/ObjC but not for C++ linking shared-object word_tagger.so c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2\libstdc++.a(sstream -inst.o):sstream-inst.cc:(.text$_ZNSt19basic_istringstreamIcSt11char_traitsIcESa IcEED1Ev[std::basic_istringstream<char, std::char_traits, std::allocator<c har> >::~basic_istringstream()]+0x0): multiple definition of std::basic_istring stream<char, std::char_traits<char>, std::allocator<char> >::~basic_istringstrea m()' c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2/libstdc++.dll.a(d00 2585.o):(.text+0x0): first defined here c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2\libstdc++.a(sstream -inst.o):sstream-inst.cc:(.text$_ZNSt15basic_stringbufIcSt11char_traitsIcESaIcEE 7_M_syncEPcjj[std::basic_stringbuf<char, std::char_traits<char>, std::allocator< char> >::_M_sync(char_, unsigned int, unsigned int)]+0x0): multiple definition o fstd::basic_stringbuf<char, std::char_traits, std::allocator >::_M _sync(char, unsigned int, unsigned int)' c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2/libstdc++.dll.a(d00 2411.o):(.text+0x0): first defined here c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2\libstdc++.a(ios-ins t.o):ios-inst.cc:(.text$_ZNSt9basic_iosIcSt11char_traitsIcEE4initEPSt15basic_str eambufIcS1_E[std::basic_ios<char, std::char_traits >::init(std::basic_stre ambuf<char, std::char_traits >)]+0x0): multiple definition of`std::basic _ios<char, std::char_traits >::init(std::basic_streambuf<char, std::char_t raits >)' c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2/libstdc++.dll.a(d00 2948.o):(.text+0x0): first defined here c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2\libstdc++.a(string- inst.o):string-inst.cc:(.text$_ZNSsD1Ev[std::basic_string<char, std::char_traits

, std::allocator >::~basic_string()]+0x0): multiple definition of `s td::basic_string, std::allocator >::~basic_st ring()' c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2/libstdc++.dll.a(d00 1427.o):(.text+0x0): first defined here c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2\libstdc++.a(string- inst.o):string-inst.cc:(.text$_ZNSs12_S_constructEjcRKSaIcE[std::basic_string, std::allocator >::_S_construct(unsigned int, c har, std::allocator const&)]+0x0): multiple definition of`std::string::_S _construct(unsigned int, char, std::allocator const&)' c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2/libstdc++.dll.a(d00 1318.o):(.text+0x0): first defined here c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2\libstdc++.a(string- inst.o):string-inst.cc:(.text$_ZNSs12_M_leak_hardEv[std::basic_string, std::allocator >::_M_leak_hard()]+0x0): multiple defin ition of `std::string::_M_leak_hard()' c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2/libstdc++.dll.a(d00 1317.o):(.text+0x0): first defined here c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2\libstdc++.a(string- inst.o):string-inst.cc:(.text$_ZNSs4_Rep10_M_destroyERKSaIcE[std::basic_string, std::allocator >::_Rep::_M_destroy(std::alloc ator const&)]+0x0): multiple definition of`std::string::_Rep::_M_destroy( std::allocator const&)' c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2/libstdc++.dll.a(d00 1333.o):(.text+0x0): first defined here c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2\libstdc++.a(string- inst.o):string-inst.cc:(.text$_ZNSs7reserveEj[std::basic_string, std::allocator >::reserve(unsigned int)]+0x0): multiple defi nition of `std::string::reserve(unsigned int)' c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2/libstdc++.dll.a(d00 1397.o):(.text+0x0): first defined here c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2\libstdc++.a(string- inst.o):string-inst.cc:(.text$_ZNSs6appendEPKcj[std::basic_string, std::allocator >::append(char const*, unsigned int)]+0x0): multiple definition of`std::string::append(char const_, unsigned int)' c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2/libstdc++.dll.a(d00 1356.o):(.text+0x0): first defined here c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2\libstdc++.a(string- inst.o):string-inst.cc:(.text$_ZNSs6appendERKSs[std::basic_string, std::allocator >::append(std::basic_string, std::allocator > const&)]+0x0): multiple definition of `std ::string::append(std::string const&)' c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2/libstdc++.dll.a(d00 1357.o):(.text+0x0): first defined here c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2\libstdc++.a(string- inst.o):string-inst.cc:(.text$_ZNSsC1ERKSs[std::basic_string, std::allocator >::basic_string(std::basic_string, std::allocator > const&)]+0x0): multiple definition of`st d::basic_string, std::allocator >::basic_stri ng(std::string const&)' c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2/libstdc++.dll.a(d00 1405.o):(.text+0x0): first defined here c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2\libstdc++.a(string- inst.o):string-inst.cc:(.text$_ZNSs6assignERKSs[std::basic_string, std::allocator >::assign(std::basic_string, std::allocator > const&)]+0x0): multiple definition of `std ::string::assign(std::string const&)' c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2/libstdc++.dll.a(d00 1364.o):(.text+0x0): first defined here c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2\libstdc++.a(string- inst.o):string-inst.cc:(.text$_ZNSsC1ERKSsjj[std::basic_string, std::allocator >::basic_string(std::basic_string, std::allocator > const&, unsigned int, unsigned int)]+0x 0): multiple definition of`std::basic_string, std: :allocator >::basic_string(std::string const&, unsigned int, unsigned int) ' c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2/libstdc++.dll.a(d00 1406.o):(.text+0x0): first defined here c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2\libstdc++.a(string- inst.o):string-inst.cc:(.text$_ZNSsC1EPKcjRKSaIcE[std::basic_string, std::allocator >::basic_string(char const_, unsigned int , std::allocator const&)]+0x0): multiple definition of `std::basic_string< char, std::char_traits, std::allocator >::basic_string(char const*, unsigned int, std::allocator const&)' c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2/libstdc++.dll.a(d00 1403.o):(.text+0x0): first defined here c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2\libstdc++.a(string- inst.o):string-inst.cc:(.text$_ZNSsC1EPKcRKSaIcE[std::basic_string, std::allocator >::basic_string(char const*, std::allocato r const&)]+0x0): multiple definition of`std::basic_string, std::allocator >::basic_string(char const_, std::allocator< char> const&)' c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2/libstdc++.dll.a(d00 1402.o):(.text+0x0): first defined here c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2\libstdc++.a(functex cept.o):functexcept.cc:(.text+0x408): multiple definition of `std::__throw_lengt h_error(char const_)' c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2/libstdc++.dll.a(d00 3058.o):(.text+0x0): first defined here c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2\libstdc++.a(locale. o):locale.cc:(.text+0x994): multiple definition of `std::locale::~locale()' c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2/libstdc++.dll.a(d00 2742.o):(.text+0x0): first defined here c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2\libstdc++.a(ios.o): ios.cc:(.text+0x0): multiple definition of`std::ios_base::ios_base()' c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2/libstdc++.dll.a(d00 2856.o):(.text+0x0): first defined here c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2\libstdc++.a(ios.o): ios.cc:(.text+0x454): multiple definition of `std::ios_base::~ios_base()' c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2/libstdc++.dll.a(d00 2859.o):(.text+0x0): first defined here c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2\libstdc++.a(atomici ty.o):atomicity.cc:(.text+0x0): multiple definition of`__gnu_cxx::__exchange_an d_add(int volatile_, int)' c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2/libstdc++.dll.a(d00 0235.o):(.text+0x0): first defined here c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2\libstdc++.a(istream .o):istream.cc:(.text+0xae4): multiple definition of `std::basic_istream >& std::operator>>, std::allo cator >(std::basic_istream >&, std::basic_str ing, std::allocator >&)' c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2/libstdc++.dll.a(d00 3198.o):(.text+0x0): first defined here c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2\libstdc++.a(eh_catc h.o):eh_catch.cc:(.text+0xc): multiple definition of`__cxa_begin_catch' c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2/libstdc++.dll.a(d00 3868.o):(.text+0x0): first defined here c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2\libstdc++.a(eh_catc h.o):eh_catch.cc:(.text+0x78): multiple definition of `__cxa_end_catch' c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2/libstdc++.dll.a(d00 3873.o):(.text+0x0): first defined here c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2\libstdc++.a(eh_thro w.o):eh_throw.cc:(.text+0xd0): multiple definition of`__cxa_rethrow' c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2/libstdc++.dll.a(d00 3883.o):(.text+0x0): first defined here c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2\libstdc++.a(eh_pers onality.o):eh_personality.cc:(.text+0x34c): multiple definition of `__gxx_person ality_sj0' c:/users/owner/devkitruby/mingw/bin/../lib/gcc/mingw32/4.5.2/libstdc++.dll.a(d00 3897.o):(.text+0x0): first defined here collect2: ld returned 1 exit status make: *_\* [word_tagger.so] Error 1 and tryig this code: require 'treat' include Treat::Core::DSL sect = section "A walk in the park\n"+ 'Obama and Sarkozy met this friday to investigate ' + 'the possibility of a new rescue plan. The French ' + 'president Sarkozy is to meet Merkel next Tuesday.' sect.do(:chunk, :segment, :parse) sect.each do |s| puts s.class puts "now whast?" end resolved with: system cannot find the path specified) (FileNotFoundException) from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bind-it-0.2.7/lib/bind-it/jar_loader.rb:61:in `set_java_logging' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bind-it-0.2.7/lib/bind-it/jar_loader.rb:46:in`init_rjb' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bind-it-0.2.7/lib/bind-it/jar_loader.rb:38:in `load_jar_rjb' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bind-it-0.2.7/lib/bind-it/jar_loader.rb:27:in`load' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bind-it-0.2.7/lib/bind-it/binding.rb:63:in `load_jar' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bind-it-0.2.7/lib/bind-it/binding.rb:71:in`block in load_default_jars' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bind-it-0.2.7/lib/bind-it/binding.rb:68:in `each' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bind-it-0.2.7/lib/bind-it/binding.rb:68:in`load_default_jars' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/bind-it-0.2.7/lib/bind-it/binding.rb:55:in `bind' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/stanford-core-nlp-0.5.1/lib/stanford-core-nlp.rb:125:in`bind' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/treat-2.0.7/lib/treat/loaders/bind_it.rb:42:in `load' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/treat-2.0.7/lib/treat/loaders/stanford.rb:8:in`load' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/treat-2.0.7/lib/treat/workers/processors/parsers/stanford.rb:24:in `parse' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/treat-2.0.7/lib/treat/entities/entity/delegatable.rb:66:in`call_worker' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/treat-2.0.7/lib/treat/entities/entity/delegatable.rb:40:in `block (2 levels) in add_workers' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/treat-2.0.7/lib/treat/entities/entity/applicable.rb:41:in`do_task' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/treat-2.0.7/lib/treat/entities/entity/applicable.rb:49:in `block in do_task' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/treat-2.0.7/lib/treat/entities/entity/applicable.rb:48:in`each' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/treat-2.0.7/lib/treat/entities/entity/applicable.rb:48:in `do_task' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/treat-2.0.7/lib/treat/entities/entity/applicable.rb:49:in`block in do_task' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/treat-2.0.7/lib/treat/entities/entity/applicable.rb:48:in `each' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/treat-2.0.7/lib/treat/entities/entity/applicable.rb:48:in`do_task' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/treat-2.0.7/lib/treat/entities/entity/applicable.rb:49:in `block in do_task' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/treat-2.0.7/lib/treat/entities/entity/applicable.rb:48:in`each' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/treat-2.0.7/lib/treat/entities/entity/applicable.rb:48:in `do_task' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/treat-2.0.7/lib/treat/entities/entity/applicable.rb:22:in`block in apply' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/treat-2.0.7/lib/treat/entities/entity/applicable.rb:6:in `each' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/treat-2.0.7/lib/treat/entities/entity/applicable.rb:6:in`apply' from C:/Users/owner/Desktop/tmp.rb:29:in `
' so there is still an issue (understand it?), and there is some mentioning of the jdk I think should be added to the manual.
louismullie commented 10 years ago

Looks like the gem is trying to find the bind-it log file, and failing (see here). I don't have a Windows box to repro, but the following should fix it:

BindIt.log_file = 'log_file.txt'

You need to place this before you require Treat or anything else.

borgr commented 10 years ago

where should I write that? in a BindIt file (can't find a readable one?) because otherwise : NameError: uninitialized constant BindIt

louismullie commented 10 years ago

You need to require 'bind-it' first. Sorry, should've made that clearer.

Sent from my iPhone

On Apr 20, 2014, at 2:25 AM, borgr notifications@github.com wrote:

where should I write that? in a BindIt file (can't find a readable one?) because otherwise : NameError: uninitialized constant BindIt

— Reply to this email directly or view it on GitHub.

borgr commented 10 years ago

well although I guess I am doing something not exactly right again, I tried all that I had in mind, the two rows have something not right.

require 'bind-it' puts BindIt.log_file = 'log_file.txt'

C:/Users/owner/Desktop/Question.rb:2:in <main>': undefined methodlog_file=' for BindIt:Module (NoMethodError)

are you sure what you suggest is possible, I am not experienced with ruby, but log_file is not a child, so why will it live outside the bind-it scope and why will I be able to change it in this manner? sorry for the inconvinience

louismullie commented 10 years ago

How about this?


class BindIt::JarLoader

  def self.set_java_logging
  end

end
borgr commented 10 years ago

it does something, just the same thing that changing the file itself did (the bindit file in the gems, I tried commenting out line 46) it makes all sentences an 0 length error:

require 'bind-it' class BindIt::JarLoader def self.set_java_logging self.log_file ='log_file.txt' end end

require 'treat' include Treat::Core::DSL

sect = section "A walk in the park\n"+ 'Obama and Sarkozy met this friday to investigate ' + 'the possibility of a new rescue plan. The French ' + 'president Sarkozy is to meet Merkel next Tuesday.'

sect.do(:chunk, :segment, :parse)

Loading parser from serialized file C:/Ruby193/lib/ruby/gems/1.9.1/gems/treat-2.0.7/models/stanford/grammar/englishPCFG.ser.gz ... done [1.0 sec]. Following exception caught during parsing: java.lang.UnsupportedOperationException: Can't parse a zero-length sentence! at edu.stanford.nlp.parser.lexparser.LexicalizedParserQuery.parse(LexicalizedParserQuery.java:206) at edu.stanford.nlp.parser.lexparser.LexicalizedParser.apply(LexicalizedParser.java:283) Recovering using fall through strategy: will construct an (X ...) tree. C:/Ruby193/lib/ruby/gems/1.9.1/gems/treat-2.0.7/lib/treat/core/dsl.rb:17:in method_missing': undefined methodchildren' for nil:NilClass (NoMethodError) from C:/Ruby193/lib/ruby/gems/1.9.1/gems/treat-2.0.7/lib/treat/workers/processors/parsers/stanford.rb:57:in recurse' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/treat-2.0.7/lib/treat/workers/processors/parsers/stanford.rb:50:inparse' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/treat-2.0.7/lib/treat/entities/entity/delegatable.rb:66:in call_worker' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/treat-2.0.7/lib/treat/entities/entity/delegatable.rb:40:inblock (2 levels) in add_workers' from C:/Ruby193/lib/ruby/gems/1.9.1/gems/treat-2.0.7/lib/treat/entities/entity/applicable.rb:41:in `do_task'

borgr commented 10 years ago

ok the zero issue was already the code, it is finally working. Think there can be something permanent to fix that (for example commenting out line 46, or is it important for linux users or something?). tnx

AnthonyDeSimone commented 10 years ago

@borgr, I'm running into the zero length error as well. What did you do to get past that?

borgr commented 10 years ago

tokenize before parsing