how to make parseIt in javaRAP? - java

I want work with javaRAP but i can't make parseIt.I have this error:
C:\Users\zahra\Documents\bllipparser-2015.08.18\first-stage\PARSE>make parseIt
g++ parseIt.C -o parseIt
In file included from InputTree.h:24,
from parseIt.C:31:
SentRep.h:22: istream: No such file or directory
SentRep.h:24: ostream: No such file or directory
make: *** [parseIt] Error 1

Install Charniak's parser (version parser05Aug16).
$ make parseIt
If you encounter the following error message, you may want to try
overwriting the files in the PARSE/ subdirectory of the parser with
those provided in the parser05Aug16.patch.zip zipfile.
[wing.nus#cte PARSE]$ make
/usr/bin/g++ -c -O BchartSm.C
BchartSm.C:30: error: expected initializer before ‘*’ token
BchartSm.C: In member function ‘float Bchart::computepTgT(int, int)’:
BchartSm.C:612: error: ‘globalGi’ was not declared in this scope
make: *** [BchartSm.o] Error 1
Get the latest JavaRAP
(http://aye.comp.nus.edu.sg/~qiu/NLPTools/JavaRAP.html), decompress
it, and modify env.jrap carefully. It's important that you add "./"
as a directory prefix even it seems unnecessary.
Try:
$ java -jar AnaphoraResolution.jar testdata/SimpleTest.txt

Related

Python3 Opencv3 Ubuntu 15 - make error

I ran into a quiet weird situation ...
Currently I try to build and install OpenCv3 for Python3 on Ubuntu 15
While compiling and installing opencv3 for python2.7 worked pretty well - doing the same for python3 (same downloaded opencv package) stops with make error 2 (actually with different errors) ...
So something's wrong with: [ 77%] Generating photo+CalibrateCRF.java, photo.cpp because afterwards I get different traceback's and errors:
Traceback (most recent call last):
File "/media/stefan/A050780B5077E706/_raspi/opencv/sources/modules/java/generator/gen_java.py", line 1559, in <module>
generator.gen(srcfiles, module, dstdir)
File "/media/stefan/A050780B5077E706/_raspi/opencv/sources/modules/java/generator/gen_java.py", line 1061, in gen
self.gen_class(ci)
File "/media/stefan/A050780B5077E706/_raspi/opencv/sources/modules/java/generator/gen_java.py", line 1460, in gen_class
for fi in ci.getAllMethods():
File "/media/stefan/A050780B5077E706/_raspi/opencv/sources/modules/java/generator/gen_java.py", line 824, in getAllMethods
result.extend([fi for fi in sorted(self.methods) if fi.isconstructor])
TypeError: unorderable types: FuncInfo() < FuncInfo()
modules/java/CMakeFiles/opencv_java.dir/build.make:86: recipe for target 'modules/java/photo+CalibrateCRF.java' failed
make[2]: *** [modules/java/photo+CalibrateCRF.java] Error 1
CMakeFiles/Makefile2:6282: recipe for target 'modules/java/CMakeFiles/opencv_java.dir/all' failed
make[1]: *** [modules/java/CMakeFiles/opencv_java.dir/all] Error 2
Makefile:137: recipe for target 'all' failed
make: *** [all] Error 2
Obviously there is something going on with the java part of OpenCV. I ran into exactly the same error but since I didn't want to use Java at all I excluded it from the build and everything worked just fine.
Here is what did the job for me:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D WITH_QT=ON -D WITH_OPENGL=ON -D WITH_TBB=ON -D CMAKE_INSTALL_PREFIX=$(python3 -c "import sys; print(sys.prefix)") -D BUILD_EXAMPLES=ON -D PYTHON_EXECUTABLE=$(which python3) -D BUILD_opencv_java=OFF BUILD_opencv_test_java=OFF ..

bad reloc address 0x0 when compiling hsdis (Java HotSpot disassembler plugin) on cygwin

I'm trying to compile the hsdis-amd64.dll library that the JVM needs to disassemble JIT compiled code.
I followed this accepted answer.
I installed cygwin
downloaded openjdk-7u40-fcs-src-b43-26_aug_2013.zip
and downloaded binutils-2.24.tar.gz
I created a folder structure like this:
+
+- hsdis // unzipped dir hotspot/src/share/tools/hsdis of openjdk zip
+- binutils-2.24 // unzipped binutils-2.24.tar.gz
First I tried to just compile it using:
$ make OS=Linux MINGW=x86_64-w64-mingw32 BINUTILS=../binutils-2.24
but it failed with
/Linux-amd64/opcodes/libopcodes.a build/Linux-amd64/libiberty/libiberty.a
hsdis.c:32:20: fatal error: sysdep.h: No such file or directory
#include <sysdep.h>
^
compilation terminated.
So I applied the patch provided in this accepted answer and tried again.
The compilation failed again
In file included from hsdis.c:34:0:
build/Linux-amd64/bfd/bfd.h:35:2: error: #error config.h must be included before this header
#error config.h must be included before this header
^
I followed the proposal of the compiler and added config.h just before the errno.h include.
Then the error is
e -I../binutils-2.24/bfd -Ibuild/Linux-amd64/bfd -DLIBARCH_amd64 -DLIBARCH=\"amd64\" -DLIB_EXT=\".dll\" -O hsdis.c -shared build/Linux-amd64/bfd/libbfd.a build/Linux-amd64/opcodes/libopcodes.a build/Linux-amd64/libiberty/libiberty.a
build/Linux-amd64/bfd/libbfd.a(compress.o):compress.c:(.text+0x15): undefined reference to `compressBound'
build/Linux-amd64/bfd/libbfd.a(compress.o):compress.c:(.text+0x48): undefined reference to `compress'
build/Linux-amd64/bfd/libbfd.a(compress.o):compress.c:(.text+0x28a): undefined reference to `inflateInit_'
build/Linux-amd64/bfd/libbfd.a(compress.o):compress.c:(.text+0x2c7): undefined reference to `inflate'
build/Linux-amd64/bfd/libbfd.a(compress.o):compress.c:(.text+0x2d6): undefined reference to `inflateReset'
build/Linux-amd64/bfd/libbfd.a(compress.o):compress.c:(.text+0x2f1): undefined reference to `inflateEnd'
/usr/lib/gcc/x86_64-w64-mingw32/4.8.1/../../../../x86_64-w64-mingw32/bin/ld: build/Linux-amd64/bfd/libbfd.a(compress.o): bad reloc address 0x0 in section `.pdata'
collect2: error: ld returned 1 exit status
I know that it is a linker problem. For me it seems that it is trying to link against a wrong version, but I might be wrong.
Does anyone knows how to solve this problem or can tell me how to compile the hsdis (HotSpot disassembler plugin)?
The problem could be solved following Marat Buharov's answer.
Nevertheless here are some links where you can find a pre-comiled hsdis plugin:
http://lafo.ssw.uni-linz.ac.at/hsdis/
https://kenai.com/projects/base-hsdis/downloads
http://classparser.blogspot.de/2010/03/hsdis-i386dll.html
I tried http://lafo.ssw.uni-linz.ac.at/hsdis/intel/hsdis-amd64.dll with jdk1.7.0_02 and it worked.
There is need to add linking against zlib (Be sure that you install package mingw64-x86_64-zlib in cygwin).
Then open Makefile in editor, find rule:
$(TARGET): $(SOURCE) $(LIBS) $(LIBRARIES) $(TARGET_DIR)
$(CC) $(OUTFLAGS) $(CPPFLAGS) $(CFLAGS) $(SOURCE) $(DLDFLAGS) $(LIBRARIES)
Add "-static -lz" to second line to make that:
$(TARGET): $(SOURCE) $(LIBS) $(LIBRARIES) $(TARGET_DIR)
$(CC) $(OUTFLAGS) $(CPPFLAGS) $(CFLAGS) $(SOURCE) $(DLDFLAGS) $(LIBRARIES) -static -lz

Error while running pjsip sample pjsua on android ndk

I successfully performed ./configure-android and make dep && make install commands using pjsip and I successfully install SWIG too.
But I am getting the following error while running the sample pjsua.
/Users/Downloads/swig-2.0.11 -c++ -o jni/pjsua_wrap.cpp -package org.pjsip.pjsua -outdir src/org/pjsip/pjsua -java jni/pjsua.i
make: execvp: /Users/Downloads/swig-2.0.11: Permission denied
make: *** [jni/pjsua_wrap.cpp] Error 127
Seems that MY_SWIG variable in pjsip-apps/src/pjsua/android/Android.mk is pointing to /Users/Downloads/swig-2.0.11 instead to swig binary file.
If you downloaded swig source to /Users/Downloads/swig-2.0.11 and you build it, binary file should be at: /Users/Downloads/swig-2.0.11/swig
Another problem you maybe find is that object files for project pjsua-app does not exists, this is because this is not done by default on the general build (more specifically, corresponding target is not included on all target at pjsip-apps/build/Makefile). To fix this just go to pjsip-apps/build and run:
make pjsua
This would create proper object files at: pjsip-apps/build/output/pjsua-arm-unknown-linux-androideabi/ (needed when building android sample)

Malt Parser throwing class not found exception

I'm trying to parse sentence with Malt Parser in NLTK. When I did raw_parse(sent) it gave an error with exit code 1. I executed java command on terminal and it gives class Not Found exception, I don't understand what is wrong now?
java -Xmx1024m -jar /usr/local/bin/malt.jar -w /home/abc/maltparser-1.7.2 -c engmalt.linear-1.7 -i /home/abc/maltparser-1.7.2/malt_input.conllrPZgwc -o /home/abc/maltparser-1.7.2/malt_output.conllDMSKpg -m parse
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Layout
Your working directory is not correctly set. Log4j is a package used by Malt Parser (see: maltparser-1.7.2/lib/log4j.jar). Which is used for logging logically.
In order to run maltparser in NLTK, the working directory should be set to this folder (in your case: /home/abc/maltparser-1.7.2).
So, step one is getting the latest NLTK from git:
git clone https://github.com/nltk/nltk.git
Install NLTK:
sudo python setup.py install
To run Malt Parser using NLTK try this code example:
import os
import nltk
os.environ['MALTPARSERHOME']="/home/abc/maltparser-1.7.2"
verbose = False
maltParser = nltk.parse.malt.MaltParser(working_dir="/home/abc/maltparser-1.7.2",
mco="engmalt.linear-1.7",
additional_java_args=['-Xmx512m'])
print(maltParser.raw_parse('This is a test sentence', verbose=verbose).tree().pprint())
As you may notice I'm using the pre-learned mco file (engmalt.linear-1.7), which can be downloaded from here:
http://www.maltparser.org/mco/english_parser/engmalt.html
Move this mco file to: /home/abc/maltparser-1.7.2 directory.
Finally NLTK only except malt.jar. So create a copy (or rename):
cp maltparser-1.7.2.jar malt.jar
Which can still be located in your /home/abc/maltparser-1.7.2.jar directory.
Hopefully you'll get it running!

Pig ERROR 2998: Unhandled internal error. Static (wrong name: com/company/Static)

I have a Pig script that returns a constant string value. When I try to run the script with the following command, I get a Pig ERROR 2998:
pig -Dpig.additional.jars=Static.jar -f script.pig -l /dev/null -x local
script.pig
loaded = LOAD 'data/' USING com.twitter.elephantbird.pig.store.LzoPigStorage() AS (request);
loaded = SAMPLE loaded 0.00001;
sized = FOREACH loaded GENERATE Static(request);
DUMP sized;
What's causing the error?
It appears to be a java.lang.NoClassDefFoundError error that nobody is catching. The error itself occurs because the jvm cannot find the class you requested.
Specifically, you seem to be missing the required directory structure in the jar. com.company.Static (i.e., the Static.class file) should be located under the com/company directory in the jar. See this other SO question for more details.
For a quick fix, take a look at this question on How to create a jar file with package structure.

Categories