How do you implement text summarization for different use cases?
Text summarization condenses long documents while preserving key information. Types: extractive (selects and combines important sentences from the source), abstractive (generates new sentences that capture the main ideas), and hybrid (extracts key sentences then rewrites for coherence). Extractive methods: TextRank (graph-based, ranks sentences by centrality using PageRank algorithm), BM25-based (select sentences most similar to the document centroid), and BERT-based (encode sentences, cluster, select representatives from each cluster). Abstractive methods: fine-tune encoder-decoder models (BART, T5, Pegasus) on summarization datasets (CNN/DailyMail, XSum), or use LLMs with prompt engineering for zero-shot summarization. LLM-based summarization: provide the document with clear instructions (target length, focus areas, audience), use chain-of-thought for complex documents (first identify key points, then synthesize), and implement map-reduce for long documents (summarize chunks, then summarize summaries). Use case optimization: news summarization (capture the 5W1H: who, what, when, where, why, how), meeting summarization (action items, decisions, key discussions), academic paper summarization (problem, method, results, contribution), legal document summarization (key obligations, terms, risks, dates), and email thread summarization (topic, participants, decisions, action items). Multi-document summarization: identify common themes across documents, detect contradictions and different perspectives, synthesize a coherent summary covering all documents, and attribute information to specific sources. Evaluation: ROUGE scores (ROUGE-1, ROUGE-2, ROUGE-L) for overlap with reference summaries, BERTScore for semantic similarity, and human evaluation for factuality, coherence, and informativeness. Quality issues: factual hallucination (generated details not in source), missing critical information, poor coherence between sentences, and redundancy.