Skip to content

Commit

Permalink
Add SSL authentication for NLTK download
Browse files Browse the repository at this point in the history
  • Loading branch information
zeynepakkalyoncu committed Jun 29, 2019
1 parent fcb26d0 commit a037292
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/utils.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
import sys
import re
import nltk
import ssl
from importlib import reload

reload(sys)

try:
_create_unverified_https_context = ssl._create_unverified_context
except AttributeError:
pass
else:
ssl._create_default_https_context = _create_unverified_https_context

nltk.download('punkt')
tokenizer = nltk.data.load('tokenizers/punkt/english.pickle')

Expand Down

0 comments on commit a037292

Please sign in to comment.