Open sunningboy opened 8 years ago
Even on Ubuntu 15.10
$ cat test.1k.txt | python python/ner/extractEntities2.py
.//python/cap/cap_classify: 1: .//python/cap/cap_classify: Syntax error: ")" unexpected
Traceback (most recent call last):
File "python/ner/extractEntities2.py", line 131, in <module>
goodCap = capClassifier.Classify(words) > 0.9
File ".//python/cap/cap_classifier.py", line 33, in Classify
self.capClassifier.stdin.write("%s\n" % self.fe.Extract(' '.join(words)))
IOError: [Errno 32] Broken pipe
Any solutions?? Have the same issue
Maybe try running build.sh
-Alan
@sunningboy, @mdtareque and @sruteesh can you try using my branch mentioned in Pull request #16, it has a much simpler interface for using an input file instead of piping the input from cat.
Hi @napsternxg and @aritter Thanks for the prompt response. But the issue still seems to be there. I'm still getting the same error. I tried trying it out on my friend's laptop. Same issue.
`$ python python/ner/extractEntities.py test.1k.txt
Input file: test.1k.txt Text Position: 0 Output file: None Chunk: False POS: False Event: False Classify: False
No output file given. Will write to STDOUT.
Error: Could not find or load main class cc.mallet.fst.SimpleTaggerStdin
/bin/sh: .//python/cap/cap_classify: cannot execute binary file: Exec format error
Finished loading all models. Now reading from test.1k.txt and writing to None
Traceback (most recent call last):
File "python/ner/extractEntities.py", line 167, in
@napsternxg and @aritter I'm getting the same error as @sruteesh is having. Can you please look into it.
@sruteesh @chandra589 I tried it just now on my machine. It works fine. Can you give details about your system ?
@napsternxg I am using pyhton 3.4 and running it on Cygwinx64 terminal from windows 10.
I think this code is compatible with only Python 2.7 because of the print statement formats. Try with Python 2.7.
I have the same issue. Any solutions?
I'm having the same issue.
/bin/sh: .//python/cap/cap_classify: No such file or directory
Finished loading all models. Now reading from test.1k.txt and writing to output.txt
Traceback (most recent call last):
File "python/ner/extractEntities.py", line 167, in <module>
goodCap = capClassifier.Classify(words) > 0.9
File ".//python/cap/cap_classifier.py", line 33, in Classify
self.capClassifier.stdin.write("%s\n" % self.fe.Extract(' '.join(words)))
IOError: [Errno 32] Broken pipe
I also got an error when running the build.sh:
warning: optimization level '-O9' is not supported; using '-O3' instead
In file included from param.cpp:28:
In file included from ./common.h:76:
./getopt.h:131:12: error: conflicting types for 'getopt'
extern int getopt ();
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/unistd.h:508:6: note:
previous declaration is here
int getopt(int, char * const [], const char *) __DARWIN_ALIAS(getopt);
^
param.cpp:217:17: warning: conversion from string literal to 'char *' is
deprecated [-Wc++11-compat-deprecated-writable-strings]
char *tmp = "TinySVM::Param::set";
^
2 warnings and 1 error generated.
make[2]: *** [param.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive-am] Error 2
ld: library not found for -lcrt0.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I'm using python 2.7.
Anybody got a solution? Facing the same issue
I have the same issue.
`
Input file: test.1k.txt Text Position: 0 Output file: output.txt Chunk: False POS: False Event: False Classify: False
/bin/sh: 1: java: not found
Finished loading all models. Now reading from test.1k.txt and writing to output.txt
Traceback (most recent call last):
File "python/ner/extractEntities.py", line 197, in
After I tried to run build.sh, this issue is still existing.
My python version: 2.7.12
same issue here, python version is Python 2.7.10. Would be great to see a fix. @napsternxg @aritter
I have some similar issue.
Anonymous:~/twitter_nlp$ python python/ner/extractEntities.py test.1k.txt -o output.txtStarting with the following configuration
----------------------------------------
Input file: test.1k.txt
Text Position: 0
Output file: output.txt
Chunk: False
POS: False
Event: False
Classify: False
Mallet Memory: 256m
----------------------------------------
/bin/sh: 1: java: not found
Finished loading all models. Now reading from test.1k.txt and writing to output.txt
Traceback (most recent call last):
File "python/ner/extractEntities.py", line 197, in <module>
ner.stdin.write(("\t".join(seq_features) + "\n").encode('utf8'))
IOError: [Errno 32] Broken pipe
And I found out that running ./build.sh
cause some errors like :
...
rm -f .libs/param.lo
c++ -DHAVE_CONFIG_H -I. -I. -I.. -Wall -O9 -funroll-all-loops -finline -ffast-math -c param.cpp -fPIC -DPIC -o .libs/param.lo
param.cpp: In member function 'int TinySVM::Param::set(const char*)':
param.cpp:217:17: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]
char *tmp = "TinySVM::Param::set";
^
c++ -DHAVE_CONFIG_H -I. -I. -I.. -Wall -O9 -funroll-all-loops -finline -ffast-math -c param.cpp -o param.o >/dev/null 2>&1
mv -f .libs/param.lo param.lo
...
rm -f .libs/model.lo
c++ -DHAVE_CONFIG_H -I. -I. -I.. -Wall -O9 -funroll-all-loops -finline -ffast-math -c model.cpp -fPIC -DPIC -o .libs/model.lo
model.cpp: In member function 'virtual int TinySVM::Model::read(const char*, const char*, int)':
model.cpp:230:57: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
fscanf (fp, "%s Version %s%*[^\n]\n", tmpbuf, version);
^
model.cpp:231:50: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
fscanf (fp, "%d%*[^\n]\n", ¶m.kernel_type);
^
model.cpp:232:45: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
fscanf (fp, "%d%*[^\n]\n", ¶m.degree);
^
model.cpp:233:46: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
fscanf (fp, "%lf%*[^\n]\n", ¶m.param_g);
^
model.cpp:234:46: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
fscanf (fp, "%lf%*[^\n]\n", ¶m.param_s);
^
model.cpp:235:46: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
fscanf (fp, "%lf%*[^\n]\n", ¶m.param_r);
^
model.cpp:236:38: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
fscanf (fp, "%s%*[^\n]\n", tmpbuf);
^
model.cpp:249:34: warning: ignoring return value of 'int fscanf(FILE*, const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
fscanf (fp, "%lf%*[^\n]\n", &b);
^
I hava met the similar problem, has anyone get a solution? when I run "python python/ner/extractEntities.py test.1k.txt -o output.txt", it got an exception as below:
Exception in thread "main" java.lang.NoClassDefFoundError: bsh/Interpreter
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at cc.mallet.util.CommandOption.
Hey, guys, good news for Mac users!
I ended up being able to build on Mac (10.12.6) by doing the following:
Download TinySVM and unzip it to the folder of twitter_nlp-master: https://github.com/shogo82148/TinySVM
Change build.sh in twitter_nlp-master as below:
cd hbc/models
gcc -O3 labels.c stats.c samplib.c LabeledLDA_infer_stdin.c -o LabeledLDA_infer_stdin.out -lm
cd ../../TinySVM
./configure --prefix=pwd
/../ && make && make install
cd ../python/cap
./build.sh
Then change the python/cap/build.sh into like below:
c++ -o cap_classify cap_classify.cpp -ltinysvm
Then run $ ./build.sh $ export TWITTER_NLP=./ $ cat test.1k.txt | python2 python/ner/extractEntities2.py
Dont forget to install tinysvm anyway using : $ brew install tinysvm
This works! Below is part of the result: @Jessica_Chobot/O did/O you/O see/O the/O yakuza/B-ENTITY vs/O zombies/O ..../O smh/O but/O cool/O at/O the/O same/O time/O RT/O @daviddesrosiers/O :/O Happy/O birthday/O @chuckcomeau/O !/O have/O fun/O in/O vancouver/B-ENTITY tonight/O !/O Spotted/O :/O Kanye/B-ENTITY West/I-ENTITY Celebrates/O LAMB/B-ENTITY With/O Gwen/B-ENTITY Stefani/I-ENTITY :/O New/B-ENTITY York/I-ENTITY Fashion/I-ENTITY Week/I-ENTITY is/O coming/O to/O a/O close/O ,/O but/O not/O before/O .../O http://bit.ly/cSyZUi/O @zeeDOTi/O i/O might/O join/O in/O if/O I/O make/O it/O home/O in/O time/O ./O :)/O
Hope this helps.
@Johnsonxiong worked for me -- thanks! maybe someone can create a PR for this.
the only thing I had to change was in the $PWD reference in ./build.sh
:
cd hbc/models
gcc -O3 labels.c stats.c samplib.c LabeledLDA_infer_stdin.c -o LabeledLDA_infer_stdin.out -lm
cd ../../TinySVM
./configure --prefix=$PWD/../ && make && make install
cd ../python/cap
./build.sh
TinySVM no longer has configure
file it seems:
https://github.com/shogo82148/TinySVM
OS is mac air OX.
How can solve it?
$ cat test.1k.txt | python python/ner/extractEntities2.py /bin/sh: .//python/cap/cap_classify: cannot execute binary file Traceback (most recent call last): File "python/ner/extractEntities2.py", line 131, in
goodCap = capClassifier.Classify(words) > 0.9
File ".//python/cap/cap_classifier.py", line 33, in Classify
self.capClassifier.stdin.write("%s\n" % self.fe.Extract(' '.join(words)))
IOError: [Errno 32] Broken pipe