def summarize(self, text, threshold: float) -> str:
    doc = self.nlp(text)
    sents = doc.sents
    '\n        Term frequency (TF) is how often a word appears in the document, divided by how many words there are in the document.\n        '
    tf_matrix = self.sent_word_freq(text)
    tf_global_matrix = self.global_word_freq(tf_matrix)
    '\n        Inverse document frequency (IDF) is how unique or rare a word is.\n        '
    idf_matrix = self.idf(tf_matrix, tf_global_matrix)
    tf_idf_matrix = self.tf_idf(tf_matrix, idf_matrix)
    sentence_scores = self.score_sentences(tf_idf_matrix)
    summary = self.generate_summary(sents, sentence_scores, threshold)
    return summary
def summarize(self, text, threshold: float) -> str:
    doc = self.nlp(text)
    sents = doc.sents
    '\n        Term frequency (TF) is how often a word appears in the document, divided by how many words there are in the document.\n        '
    tf_matrix = self.sent_word_freq(text)
    tf_global_matrix = self.global_word_freq(tf_matrix)
    '\n        Inverse document frequency (IDF) is how unique or rare a word is.\n        '
    idf_matrix = self.idf(tf_matrix, tf_global_matrix)
    tf_idf_matrix = self.tf_idf(tf_matrix, idf_matrix)
    sentence_scores = self.score_sentences(tf_idf_matrix)
    summary = self.generate_summary(sents, sentence_scores, threshold)
    return summary