Closed
Description
Hi,
I try to use CoreNLPDependencyParser to extract POS and dependency structure. but httperror will come out if percentage sign (%) is included in the sentence. a simple demo is as below.
from nltk.parse import CoreNLPDependencyParser
words_processed = ['it', "'s", 'because', 'when', 'you', 'buy', 'it', '%']
depparser = CoreNLPDependencyParser(url='http://localhost:9001')
temp_parser_res = depparser.parse(words_processed)
print(temp_parser_res)
[Output]:
HTTPError Traceback (most recent call last)
<ipython-input-28-301966b0519c> in <module>()
5 words_processed = ['it', "'s", 'because', 'when', 'you', 'buy', 'it', '%']
6 depparser = CoreNLPDependencyParser(url='http://localhost:9001')
----> 7 temp_parser_res = depparser.parse(words_processed)
8 print(temp_parser_res)
3 frames
/usr/local/lib/python3.7/dist-packages/nltk/parse/api.py in parse(self, sent, *args, **kwargs)
43
44 if overridden(self.parse_sents):
---> 45 return next(self.parse_sents([sent], *args, **kwargs))
46 elif overridden(self.parse_one):
47 return (tree for tree in [self.parse_one(sent, *args, **kwargs)] if tree is not None)
/usr/local/lib/python3.7/dist-packages/nltk/parse/corenlp.py in raw_parse_sents(self, sentences, verbose, properties, *args, **kwargs)
288 yield iter([tree])
289 """
--> 290 parsed_data = self.api_call('\n'.join(sentences), properties=default_properties)
291 for parsed_sent in parsed_data['sentences']:
292 tree = self.make_tree(parsed_sent)
/usr/local/lib/python3.7/dist-packages/nltk/parse/corenlp.py in api_call(self, data, properties)
249 )
250
--> 251 response.raise_for_status()
252
253 return response.json()
/usr/local/lib/python3.7/dist-packages/requests/models.py in raise_for_status(self)
939
940 if http_error_msg:
--> 941 raise HTTPError(http_error_msg, response=self)
942
943 def close(self):
HTTPError: 500 Server Error: Internal Server Error for url: http://localhost:9001/?properties=%7B%22outputFormat%22%3A+%22json%22%2C+%22annotators%22%3A+%22tokenize%2Cpos%2Clemma%2Cssplit%2Cdepparse%22%2C+%22ssplit.ssplit.eolonly%22%3A+%22true%22%7D
any help about this issue is greatly appreciated.
Metadata
Metadata
Assignees
Labels
No labels