Skip to content

Commit

Permalink
fix breaking change in nltk
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjoyo committed Oct 28, 2024
1 parent 34fafc0 commit c1bddde
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bpm_ai_inference/translation/easy_nmt/easy_nmt.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,9 +407,9 @@ def sentence_splitting(self, text: str, lang: str = None):
sentences = list(re.findall(u'[^!?。\.]+[!?。\.]*', text, flags=re.U))
else:
try:
nltk.data.find('tokenizers/punkt')
nltk.data.find('tokenizers/punkt_tab')
except LookupError:
nltk.download('punkt')
nltk.download('punkt_tab')

sentences = nltk.sent_tokenize(text)

Expand Down

0 comments on commit c1bddde

Please sign in to comment.