Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to parse #74

Open
borgr opened this issue Apr 17, 2014 · 11 comments
Open

unable to parse #74

borgr opened this issue Apr 17, 2014 · 11 comments

Comments

@borgr
Copy link

borgr commented Apr 17, 2014

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
Copy link
Owner

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
Copy link
Author

borgr commented Apr 19, 2014

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
porter_stemmer.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 >::~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 f std::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 ofstd::basic _ios<char, std::char_traits<char> >::init(std::basic_streambuf<char, std::char_t raits<char> >*)' 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 <char>, std::allocator<char> >::~basic_string()]+0x0): multiple definition of s
td::basic_string<char, std::char_traits, 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<ch
ar, std::char_traits, std::allocator >::_S_construct(unsigned int, c
har, std::allocator const&)]+0x0): multiple definition ofstd::string::_S _construct(unsigned int, char, std::allocator<char> 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<char, std: :char_traits<char>, std::allocator<char> >::_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<c
har, std::char_traits, std::allocator >::_Rep::_M_destroy(std::alloc
ator const&)]+0x0): multiple definition ofstd::string::_Rep::_M_destroy( std::allocator<char> 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<char, std::char_ traits<char>, std::allocator<char> >::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<char, std::cha
r_traits, std::allocator >::append(char const
, unsigned int)]+0x0):
multiple definition ofstd::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<char, std::cha r_traits<char>, std::allocator<char> >::append(std::basic_string<char, std::char _traits<char>, std::allocator<char> > 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<char, std::char_tra
its, std::allocator >::basic_string(std::basic_string<char, std::cha
r_traits, std::allocator > const&)]+0x0): multiple definition ofst d::basic_string<char, std::char_traits<char>, std::allocator<char> >::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<char, std::cha r_traits<char>, std::allocator<char> >::assign(std::basic_string<char, std::char _traits<char>, std::allocator<char> > 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<char, std::char_t
raits, std::allocator >::basic_string(std::basic_string<char, std::c
har_traits, std::allocator > const&, unsigned int, unsigned int)]+0x
0): multiple definition ofstd::basic_string<char, std::char_traits<char>, std: :allocator<char> >::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<char, std::c har_traits<char>, std::allocator<char> >::basic_string(char const_, unsigned int , std::allocator<char> 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<char, std::ch
ar_traits, std::allocator >::basic_string(char const, std::allocato
r const&)]+0x0): multiple definition ofstd::basic_string<char, std::char _traits<char>, std::allocator<char> >::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 ofstd::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<char, s td::char_traits<char> >& std::operator>><char, std::char_traits<char>, std::allo cator<char> >(std::basic_istream<char, std::char_traits<char> >&, std::basic_str ing<char, std::char_traits<char>, std::allocator<char> >&)' 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:ininit_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:inload'
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:inblock 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:inload_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:inbind'
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:inload'
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:incall_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:indo_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:ineach'
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:inblock 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:indo_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:ineach'
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:inblock 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:inapply'
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
Copy link
Owner

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
Copy link
Author

borgr commented Apr 20, 2014

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

@louismullie
Copy link
Owner

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 [email protected] 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
Copy link
Author

borgr commented Apr 21, 2014

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
Copy link
Owner

How about this?

class BindIt::JarLoader

  def self.set_java_logging
  end

end

@borgr
Copy link
Author

borgr commented Apr 22, 2014

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
Copy link
Author

borgr commented Apr 23, 2014

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
Copy link

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

@borgr
Copy link
Author

borgr commented May 8, 2014

tokenize before parsing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants