raoariel / NLP-Question-Answer-System

52 stars 31 forks source link

Error about json running project #5

Open metehanyldz opened 5 years ago

metehanyldz commented 5 years ago

Traceback (most recent call last): File "C:\Users\NB\Downloads\NLP-Question-Answer-System-master (1)\NLP-Question-Answer-System-master\simpleQueryAnswering.py", line 117, in parse = json.loads(corenlp.parse(sentence)) File "C:\Python27\lib\json__init__.py", line 339, in loads return _default_decoder.decode(s) File "C:\Python27\lib\json\decoder.py", line 364, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) TypeError: expected string or buffer

sayak1711 commented 5 years ago

I got past the error in the following way: Do the following steps somewhere outside this project folder:

sudo pip install pexpect unidecode
git clone git://github.com/dasmith/stanford-corenlp-python.git
cd stanford-corenlp-python
wget http://nlp.stanford.edu/software/stanford-corenlp-full-2014-08-27.zip
unzip stanford-corenlp-full-2014-08-27.zip

Now open simpleQueryAnswering.py and include these import statements:

import json
from jsonrpc import ServerProxy, JsonRpc20, TransportTcpIp
from simplejson import loads

and replace the line corenlp = StanfordCoreNLP() with

server = ServerProxy(JsonRpc20(), TransportTcpIp(addr=("127.0.0.1", 8080)))

Then replace the line

parse = json.loads(corenlp.parse(sentence))

with

vparse = loads(server.parse(sentence))

and

for worddata in parse["sentences"][0]["words"]:

with

 for worddata in vparse["sentences"][0]["words"]:

Now open a terminal in stanford-corenlp-python which you cloned earlier Run: python corenlp.py Now run your simpleQueryAnswering.py That error won't come

But now I have no idea what kind of files it expects as input argument. If you have any idea on the same let me know.

metehanyldz commented 5 years ago

No, sorry i couldnt make it run. I checked similar projects on github

23 Oca 2019 Çar 09:27 tarihinde Sayak Chattopadhyay < notifications@github.com> şunu yazdı:

Hi same issue here. Found any solution yet?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/raoariel/NLP-Question-Answer-System/issues/5#issuecomment-456685925, or mute the thread https://github.com/notifications/unsubscribe-auth/ArvBQ0TGFGUCSbGTk2pk__jWjEqoxgOjks5vGADegaJpZM4ZSVQj .