Skip to content

Commit

Permalink
fixed a runner exception
Browse files Browse the repository at this point in the history
  • Loading branch information
0x4f53 committed Nov 23, 2023
1 parent 4afe9ad commit 328c7fc
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions text_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,15 @@ def regional_pii(text):
from nltk import word_tokenize, pos_tag, ne_chunk
from nltk.corpus import stopwords

if not nltk.data.find('tokenizers/punkt'): nltk.download('punkt')
if not nltk.data.find('chunkers/maxent_ne_chunker'): nltk.download('maxent_ne_chunker')
if not nltk.data.find('corpora/words.zip'): nltk.download('words')
try:
if not nltk.data.find('tokenizers/punkt'): nltk.download('punkt')
if not nltk.data.find('chunkers/maxent_ne_chunker'): nltk.download('maxent_ne_chunker')
if not nltk.data.find('corpora/words.zip'): nltk.download('words')
except LookupError:
nltk.download('punkt')
nltk.download('maxent_ne_chunker')
nltk.download('words')

stop_words = set(stopwords.words('english'))

words = word_tokenize(text)
Expand Down

0 comments on commit 328c7fc

Please sign in to comment.