algo-nlp-summarization
Implement text summarization using extractive and abstractive approaches. Use this skill when the user needs to condense long documents, build an automatic summarization pipeline, or compare summarization strategies — even if they say 'summarize this document', 'TLDR', or 'key points extraction'.
pinned to #4e7f4f8updated last month
Ask your AI client: “install skills/algo-nlp-summarization”.
Requires the metahub MCP server installed in your client. Set up MCP.
mh install skills/algo-nlp-summarizationmetahub onboarded this repo on the author's behalf.
If you own github.com/asgard-ai-platform/skills on GitHub, claim the listing to take over publishing. Your claim preserves the existing eval history and badges; only the curator label is replaced with verified-publisher on your next publish.
Stars
225
Last commit
last month
Latest release
published
- #ai-agent
- #anthropic
- #claude
- #claude-agent-skills
- #claude-code
- #coding-agent
- #knowledge-base
- #mcp
- #methodology
- #open-source
- #prompt-engineering
- #skills
- #taiwan
Automated checks the publisher passed at publish time — structure, docs, safety, and whether the artifact behaves as claimed.4e7f4f8· last month
Behavioral checks ran but aren't published for this artifact; the static checks above ran at publish time.
Documentation
8 passed1 warningHomepage or repository declaredwarn
No homepage or repository declared.
Add a "homepage" or "repository" field to SKILL.md.
Description quality
41 words · 297 chars — "Implement text summarization using extractive and abstractive approaches. Use th…"
README is present and substantial
33,936 chars · 20 sections · 3 code blocks
Tags / topics declared
13 total — ai-agent, anthropic, claude, claude-agent-skills, claude-code, coding-agent (+7)
README has usage / example sections
no labeled section but 3 code blocks document usage
Homepage / docs URL declared
https://vault.asgard-ai.com/skills/
Description is substantive
Description is 41 words.
Documentation present and substantive
Documentation present (SKILL.md, 565 words).
Documentation shows usage
Documentation includes 2 code examples.
Release history
1- releasecurrent4e7f4f8warnlast month
Contents
Text Summarization
Overview
Text summarization condenses documents while preserving key information. Extractive: selects and concatenates important sentences from the original. Abstractive: generates new text that paraphrases the content. Extractive is simpler and more faithful; abstractive is more fluent but may hallucinate.
When to Use
Trigger conditions:
- Condensing long documents, reports, or article collections
- Building automated summary pipelines for content curation
- Comparing extractive vs abstractive approaches for a use case
When NOT to use:
- When full document understanding is needed (summarization loses detail)
- For structured data extraction (use NER or information extraction)
Algorithm
IRON LAW: Abstractive Summarization Can HALLUCINATE
Abstractive models may generate fluent text containing facts NOT in
the source. Always verify key claims in abstractive summaries against
the original document. For high-stakes use cases (legal, medical),
prefer extractive or use abstractive with factual consistency checking.
Phase 1: Input Validation
Determine: input length, target summary length (ratio or word count), single-doc vs multi-doc, domain. Gate: Input text available, target length defined.
Phase 2: Core Algorithm
Extractive (TextRank/LexRank):
- Split document into sentences
- Build similarity graph (sentence nodes, cosine similarity edges)
- Run PageRank on sentence graph
- Select top-k sentences by rank, reorder by original position
Abstractive (transformer-based):
- Use pre-trained model (BART, T5, Pegasus)
- Encode input document (handle length limits with chunking if needed)
- Generate summary with beam search
- Post-process: check for repetition, factual consistency
Phase 3: Verification
Evaluate: ROUGE scores (ROUGE-1, ROUGE-2, ROUGE-L) against reference summaries. Manual check for factual accuracy and coherence. Gate: ROUGE scores reasonable for domain, no hallucinations in spot-check.
Phase 4: Output
Return summary with metadata.
Output Format
{
"summary": "The company reported Q4 revenue of...",
"method": "extractive_textrank",
"metadata": {"input_words": 2000, "summary_words": 200, "compression_ratio": 0.10, "sentences_selected": 5}
}
Examples
Sample I/O
Input: 2000-word news article about quarterly earnings Expected: 200-word summary covering: revenue, profit, guidance, key highlights. Extractive: 5-6 selected sentences. Abstractive: coherent paragraph.
Edge Cases
| Input | Expected | Why |
|---|---|---|
| Very short input (< 100 words) | Return as-is or minimal trimming | Already concise |
| Multiple contradicting sections | Summary may miss nuance | Summarization favors dominant theme |
| Technical jargon | Extractive preserves, abstractive may simplify | Domain expertise affects quality |
Gotchas
- ROUGE ≠ quality: ROUGE measures n-gram overlap with references. A high-ROUGE summary can be incoherent, and a low-ROUGE summary can be excellent with different word choices.
- Input length limits: Transformer models have max token limits (512-4096). Long documents need chunking strategies (chunk-then-summarize or hierarchical summarization).
- Repetition: Abstractive models sometimes repeat phrases. Use repetition penalty during generation (no_repeat_ngram_size).
- Position bias: In news text, important information is front-loaded (inverted pyramid). Simple "take first N sentences" is a strong extractive baseline.
- Multi-document summarization: Summarizing multiple related documents requires handling redundancy and contradiction across sources.
References
- For TextRank/LexRank implementation details, see
references/graph-based-extraction.md - For factual consistency checking, see
references/factual-consistency.md
Reviews
No reviews yet. Be the first.
Related
Verification Before Completion
Evidence before assertions, always
Writing Plans
Turn specs into phased implementation plans
Test-Driven Development
Red → green → refactor discipline for any feature or bugfix
mh install skills/algo-nlp-summarization