Skip to content

Commit

Permalink
add checker for punkt
Browse files Browse the repository at this point in the history
  • Loading branch information
dianzrong committed Jun 21, 2023
1 parent 0ed8dfd commit 4bcb474
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions openadapt/strategies/mixins/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,13 @@ def get_summary(
text: str,
num_sentences: int,
) -> str:
while(True):
try:
Tokenizer("english")
break
except:
nltk.download('punkt')

parser = PlaintextParser.from_string(text, Tokenizer("english"))
summarized = self.summarizer(parser.document, num_sentences)
return summarized

if __name__ == "__main__":
while(True):
try:
Tokenizer("english")
break
except:
nltk.download('punkt')

0 comments on commit 4bcb474

Please sign in to comment.