ProjetPP / PPP-QuestionParsing-Grammatical

Question Parsing module for the PPP using a grammatical approch
GNU Affero General Public License v3.0
33 stars 11 forks source link

Failed to run demos due to JSONDecodeError #154

Closed always19 closed 7 years ago

always19 commented 8 years ago

I'm interested in representing semantic of sentences so that I want to try yours. I succeeded to run only demo1.python

All other demos seem not to work due to the following JSONDecodeError

PPP-QuestionParsing-Grammatical/demo$ python3 demo3.py > demo.dot
Where is the capital of Belgium?
Traceback (most recent call last):
  File "demo3.py", line 29, in <module>
    print(get_tree())
  File "demo3.py", line 24, in get_tree
    result = nlp.parse(sentence)
  File "demo3.py", line 17, in parse
    result = r.json()['sentences'][0]
  File ".../lib/python3.5/site-packages/requests/models.py", line 826, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I tried pip install jsonrpclib. Then, now I can't even run the corenlp server.

Scripts$ CORENLP="stanford-corenlp-full-2014-08-27" CORENLP_OPTIONS="-parse.flags \" -makeCopulaHead\"" python3 -m corenlp -p 9000
Traceback (most recent call last):
  File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File ".../lib/python3.5/site-packages/corenlp/__main__.py", line 3, in <module>
    corenlp.main()
  File ".../lib/python3.5/site-packages/corenlp/corenlp.py", line 561, in main
    from jsonrpclib.SimpleJSONRPCServer import SimpleJSONRPCServer
ImportError: No module named 'jsonrpclib'

Any ideas?

progval commented 8 years ago

Regarding the ImportError: the right command is pip3 install jsonrpclib. pip is for Python 2, not Python 3. Installing it for Python 2 should not have triggered the error on Python 3, though.

Ping @Ezibenroc, regarding the first error.

Ezibenroc commented 8 years ago

From this command you used:

Scripts$ CORENLP="stanford-corenlp-full-2014-08-27" CORENLP_OPTIONS="-parse.flags \" -makeCopulaHead\"" python3 -m corenlp -p 9000

I think you are using an outdated version of CoreNLP. Since #149, we use the server provided by CoreNLP. Prior to that, the library did not have any server, so we had to wrap it with some Python code.

You can use dependencies.sh to install the correct version and launch the server. I updated the README to add this instruction.

always19 commented 7 years ago

Thank you! I ran demo1, 2, 3, (4).py successfully for now.