-
Couldn't load subscription status.
- Fork 286
Description
Upon calling ThaiNameTagger(), get the following error:
URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1131)>
Seems like I can not download the model for ThaiNER (both 1.4 and 1.5 version)
According to this
#298
the model are not downloaded together with the package during installation
I've also tried the link according to this colab but the link no longer exist
https://colab.research.google.com/drive/1fUTGpj4tXJFm0Uz5Ae39Bj3yFPOeLFij
Full Error
Corpus: thainer-1.4
- Downloading: thainer-1.4 1.4
SSLCertVerificationError Traceback (most recent call last)
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py in do_open(self, http_class, req, **http_conn_args)
1353 try:
-> 1354 h.request(req.get_method(), req.selector, req.data, headers,
1355 encode_chunked=req.has_header('Transfer-encoding'))
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py in request(self, method, url, body, headers, encode_chunked)
1251 """Send a complete request to the server."""
-> 1252 self._send_request(method, url, body, headers, encode_chunked)
1253
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py in _send_request(self, method, url, body, headers, encode_chunked)
1297 body = _encode(body, 'body')
-> 1298 self.endheaders(body, encode_chunked=encode_chunked)
1299
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py in endheaders(self, message_body, encode_chunked)
1246 raise CannotSendHeader()
-> 1247 self._send_output(message_body, encode_chunked=encode_chunked)
1248
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py in _send_output(self, message_body, encode_chunked)
1006 del self._buffer[:]
-> 1007 self.send(msg)
1008
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py in send(self, data)
946 if self.auto_open:
--> 947 self.connect()
948 else:
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/http/client.py in connect(self)
1420
-> 1421 self.sock = self._context.wrap_socket(self.sock,
1422 server_hostname=server_hostname)
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py in wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, session)
499 # ctx._wrap_socket()
--> 500 return self.sslsocket_class._create(
501 sock=sock,
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py in _create(cls, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, context, session)
1039 raise ValueError("do_handshake_on_connect should not be specified for non-blocking sockets")
-> 1040 self.do_handshake()
1041 except (OSError, ValueError):
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/ssl.py in do_handshake(self, block)
1308 self.settimeout(None)
-> 1309 self._sslobj.do_handshake()
1310 finally:
SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1131)
During handling of the above exception, another exception occurred:
URLError Traceback (most recent call last)
in
----> 1 ner_tagging(tokens)
in ner_tagging(tokens)
11
12 # Bug ***
---> 13 ner = ThaiNameTagger(version='1.4')
14 sentence_ner = ner.get_ner(tokens)
15
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pythainlp/tag/named_entity.py in init(self, version)
85
86 if version == "1.4":
---> 87 self.crf.open(get_corpus_path("thainer-1.4", version="1.4"))
88 self.pos_tag_name = "orchid_ud"
89 else:
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pythainlp/corpus/core.py in get_corpus_path(name, version)
164
165 if not corpus_db_detail or not corpus_db_detail.get("filename"):
--> 166 download(name, version = version)
167 corpus_db_detail = get_corpus_db_detail(name)
168
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pythainlp/corpus/core.py in download(name, force, url, version)
363 if force or not found:
364 print(f"- Downloading: {name} {version}")
--> 365 _download(
366 corpus_versions["download_url"], file_name,
367 )
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pythainlp/corpus/core.py in _download(url, dst)
188 _CHUNK_SIZE = 64 * 1024 # 64 KiB
189
--> 190 file_size = int(urlopen(url).info().get("Content-Length", -1))
191 r = requests.get(url, stream=True)
192 with open(get_full_data_path(dst), "wb") as f:
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py in urlopen(url, data, timeout, cafile, capath, cadefault, context)
220 else:
221 opener = _opener
--> 222 return opener.open(url, data, timeout)
223
224 def install_opener(opener):
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py in open(self, fullurl, data, timeout)
523
524 sys.audit('urllib.Request', req.full_url, req.data, req.headers, req.get_method())
--> 525 response = self._open(req, data)
526
527 # post-process response
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py in _open(self, req, data)
540
541 protocol = req.type
--> 542 result = self._call_chain(self.handle_open, protocol, protocol +
543 '_open', req)
544 if result:
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py in _call_chain(self, chain, kind, meth_name, *args)
500 for handler in handlers:
501 func = getattr(handler, meth_name)
--> 502 result = func(*args)
503 if result is not None:
504 return result
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py in https_open(self, req)
1395
1396 def https_open(self, req):
-> 1397 return self.do_open(http.client.HTTPSConnection, req,
1398 context=self._context, check_hostname=self._check_hostname)
1399
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/urllib/request.py in do_open(self, http_class, req, **http_conn_args)
1355 encode_chunked=req.has_header('Transfer-encoding'))
1356 except OSError as err: # timeout error
-> 1357 raise URLError(err)
1358 r = h.getresponse()
1359 except:
URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1131)>