CoreNLP
CoreNLP copied to clipboard
JSONDecodeError when calling Chinese jar in Python
I have download stanfordcorenlp 3.9.1.1 and the newest zip file stanford-corenlp-latest, still download Chinese model jar in this folder, when I run the code,
from stanfordcorenlp import StanfordCoreNLP
sentence = "香港理工大学校长滕锦光表示,任何情况下暴力都不是解决问题的方法。"
nlp_ch = StanfordCoreNLP(r'C:\stanford-corenlp-full-2018-02-27', lang='zh')
print('named entities:',nlp_ch.ner(sentence))
It shows error,
Exception has occurred: JSONDecodeError
Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
File "[C:\...\stanford_filter.py]()", line 22, in <module>
print('named entities:',nlp_ch.ner(sentence))
I have tried to download stanza, correct Json file but still didn't word, any idea?
P.S python version is 3.7.0
If you can tell us what's going on with stanza, we can investigate that, but we're not responsible for the stanfordcorenlp package
import stanza
sentence = "香港理工大学校长滕锦光表示,任何情况下暴力都不是解决问题的方法。"
stanza.download('zh')
nlp_ch = stanza.Pipeline('zh')
doc = nlp_ch(sentence)
print(doc)
print(doc.entities)
Exception has occurred: SSLError
HTTPSConnectionPool(host='raw.githubusercontent.com', port=443): Max retries exceeded with url: /stanfordnlp/stanza-resources/main/resources_1.3.0.json (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1045)')))
During handling of the above exception, another exception occurred:
I mean, removing the traceback defeats the purpose of sending us the error. However, the only line here which can cause that is the download, so whatever.
Are you able to see these pages?
https://github.com/stanfordnlp/stanza-resources https://github.com/stanfordnlp/stanza-resources/blob/main/resources_1.3.0.json
On Mon, Feb 28, 2022 at 7:18 PM ZY.Li @.***> wrote:
import stanza
sentence = "香港理工大学校长滕锦光表示,任何情况下暴力都不是解决问题的方法。"
stanza.download('zh')
nlp_ch = stanza.Pipeline('zh')
doc = nlp_ch(sentence)
print(doc)
print(doc.entities)
Exception has occurred: SSLError
HTTPSConnectionPool(host='raw.githubusercontent.com', port=443): Max retries exceeded with url: /stanfordnlp/stanza-resources/main/resources_1.3.0.json (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1045)')))
During handling of the above exception, another exception occurred:
— Reply to this email directly, view it on GitHub https://github.com/stanfordnlp/CoreNLP/issues/1255#issuecomment-1054957249, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA2AYWIM3JPVJCDTUCRO543U5WEBXANCNFSM5PSWALAA . 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.
You are receiving this because you commented.Message ID: @.***>