Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTPERROR: 500 Server Error (CoreNLPDependencyParser) [CoreNLP ver: 4.3.2] #1226

Closed
JingliSHI0206 opened this issue Dec 2, 2021 · 6 comments

Comments

@JingliSHI0206
Copy link

JingliSHI0206 commented Dec 2, 2021

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.

@JingliSHI0206 JingliSHI0206 changed the title HTTPERROR: 500 Server Error (CoreNLPDependencyParser) HTTPERROR: 500 Server Error (CoreNLPDependencyParser) [CoreNLP ver: 4.3.2] Dec 2, 2021
@AngledLuffa
Copy link
Contributor

AngledLuffa commented Dec 3, 2021 via email

@AngledLuffa
Copy link
Contributor

20fe1e9

@AngledLuffa
Copy link
Contributor

Would you try this? I think it should compensate for that issue without breaking the stanza integration

https://nlp.stanford.edu/software/stanford-corenlp-4.3.2b.zip

@JingliSHI0206
Copy link
Author

i fix this issue by replacing % with %20.
thank you so much for your suggestion.

@AngledLuffa
Copy link
Contributor

AngledLuffa commented Dec 5, 2021 via email

@JingliSHI0206
Copy link
Author

thank you for correcting me. it's a typo.

Please note that %20 is a space, and %25 is the percent sign in the original text.

On Sun, Dec 5, 2021 at 3:36 PM Jingli Shi @.***> wrote: i fix this issue by replacing % with %20. thank you so much for your suggestion. — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#1226 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA2AYWIUIRF46I5B7LVKZMLUPPZQJANCNFSM5JG2C3ZA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants