diff --git a/openadapt/strategies/mixins/summary.py b/openadapt/strategies/mixins/summary.py index cb52e0924..509527608 100644 --- a/openadapt/strategies/mixins/summary.py +++ b/openadapt/strategies/mixins/summary.py @@ -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')