
keyword-extractor
Extract keywords and key phrases from text using TF-IDF, RAKE, and frequency analysis. Generate word clouds and export to various formats.
- Installs
- 73
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/dkyazzentwatwa/chatgpt-skills --skill keyword-extractor- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads keyword-extractor automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Keyword Extractor
Extract important keywords and key phrases from text documents using multiple algorithms. Supports TF-IDF, RAKE, and simple frequency analysis with word cloud visualization.
Quick Start
from scripts.keyword_extractor import KeywordExtractor
# Extract keywords
extractor = KeywordExtractor()
keywords = extractor.extract("Your long text document here...")
print(keywords[:10]) # Top 10 keywords
# From file
keywords = extractor.extract_from_file("document.txt")
extractor.to_wordcloud("keywords.png")
Features
- Multiple Algorithms: TF-IDF, RAKE, frequency-based
- Key Phrases: Extract multi-word phrases, not just single words
- Scoring: Relevance scores for ranking
- Stopword Filtering: Built-in + custom stopwords
- N-gram Support: Unigrams, bigrams, trigrams
- Word Cloud: Visualize keyword importance
- Batch Processing: Process multiple documents
API Reference
Initialization
extractor = KeywordExtractor(
method="tfidf", # tfidf, rake, frequency
max_keywords=20, # Maximum keywords to return
min_word_length=3, # Minimum word length
ngram_range=(1, 3) # Unigrams to trigrams
)
Extraction Methods
# TF-IDF (best for comparing documents)
keywords = extractor.extract(text, method="tfidf")
# RAKE (best for key phrases)
keywords = extractor.extract(text, method="rake")
# Frequency (simple word counts)
keywords = extractor.extract(text, method="frequency")
Results Format
keywords = extractor.extract(text)
# Returns list of tuples: [(keyword, score), ...]
# [('machine learning', 0.85), ('data science', 0.72), ...]
# Get just keywords
keyword_list = extractor.get_keywords(text)
# ['machine learning', 'data science', ...]
Customization
# Add custom stopwords
extractor.add_stopwords(['company', 'product', 'service'])
# Set minimum frequency
extractor.min_frequency = 2
# Filter by part of speech (nouns only)
extractor.pos_filter = ['NN', 'NNS', 'NNP']
Visualization
# Generate word cloud
extractor.to_wordcloud("wordcloud.png", colormap="viridis")
# Bar chart of top keywords
extractor.plot_keywords("keywords.png", top_n=15)
Export
# To JSON
extractor.to_json("keywords.json")
# To CSV
extractor.to_csv("keywords.csv")
# To plain text
extractor.to_text("keywords.txt")
CLI Usage
# Extract from text
python keyword_extractor.py --text "Your text here" --top 10
# Extract from file
python keyword_extractor.py --input document.txt --method tfidf --output keywords.json
# Generate word cloud
python keyword_extractor.py --input document.txt --wordcloud cloud.png
# Batch process directory
python keyword_extractor.py --input-dir ./docs --output keywords_all.csv
CLI Arguments
| Argument | Description | Default |
|---|---|---|
--text | Text to analyze | - |
--input | Input file path | - |
--input-dir | Directory of files | - |
--output | Output file | - |
--method | Algorithm (tfidf, rake, frequency) | tfidf |
--top | Number of keywords | 20 |
--ngrams | N-gram range (e.g., "1,2") | 1,3 |
--wordcloud | Generate word cloud | - |
--stopwords | Custom stopwords file | - |
Examples
Article Keyword Extraction
extractor = KeywordExtractor(method="tfidf")
article = """
Machine learning is transforming data science. Deep learning models
are achieving state-of-the-art results in natural language processing
and computer vision. Neural networks continue to advance...
"""
keywords = extractor.extract(article, top_n=10)
for keyword, score in keywords:
print(f"{score:.3f}: {keyword}")
Compare Multiple Documents
extractor = KeywordExtractor(method="tfidf")
docs = [
open("doc1.txt").read(),
open("doc2.txt").read(),
open("doc3.txt").read()
]
# Extract keywords from each
for i, doc in enumerate(docs):
keywords = extractor.extract(doc, top_n=5)
print(f"\nDocument {i+1}:")
for kw, score in keywords:
print(f" {kw}: {score:.3f}")
SEO Keyword Research
extractor = KeywordExtractor(
method="rake",
ngram_range=(2, 4), # Focus on phrases
max_keywords=30
)
webpage_content = open("page.html").read()
keywords = extractor.extract(webpage_content)
# Filter by score threshold
high_value = [(kw, s) for kw, s in keywords if s > 0.5]
print("High-value keywords for SEO:")
for kw, score in high_value:
print(f" {kw}")
Algorithm Comparison
| Algorithm | Best For | Strengths |
|---|---|---|
| TF-IDF | Document comparison | Finds unique terms, good for search |
| RAKE | Key phrases | Extracts multi-word concepts |
| Frequency | Quick overview | Simple, fast, interpretable |
Dependencies
scikit-learn>=1.2.0
nltk>=3.8.0
pandas>=2.0.0
matplotlib>=3.7.0
wordcloud>=1.9.0
Limitations
- English optimized (other languages need language-specific stopwords)
- Very short texts may not have enough data for TF-IDF
- Domain-specific jargon may need custom stopword handling
FAQ
What does the keyword-extractor skill do?
Extract keywords and key phrases from text using TF-IDF, RAKE, and frequency analysis. Generate word clouds and export to various formats.
How do I install keyword-extractor?
Run npx skills add https://github.com/dkyazzentwatwa/chatgpt-skills --skill keyword-extractor in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/keyword-extractor/ (personal) or .claude/skills/keyword-extractor/ (project).
Which AI agents can use keyword-extractor?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is keyword-extractor safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains keyword-extractor?
It is published by dkyazzentwatwa in dkyazzentwatwa/chatgpt-skills. It has 73 recorded installs.
More from dkyazzentwatwa/chatgpt-skills
ocr-document-processor
dkyazzentwatwa/chatgpt-skills
Extract text and structure from scans, images, and scanned PDFs. Use for OCR, searchable PDFs, table extraction, receipt parsing, and business card parsing.
crypto-ta-analyzer
dkyazzentwatwa/chatgpt-skills
Run multi-indicator technical analysis on crypto or market OHLCV data. Use for deterministic trend, momentum, volume, and divergence analysis.
text-summarizer
dkyazzentwatwa/chatgpt-skills
Generate extractive summaries from long text documents. Control summary length, extract key sentences, and process multiple documents.
financial-calculator
dkyazzentwatwa/chatgpt-skills
Run loan, investment, NPV, retirement, savings, and risk calculations with schedules and charts. Use for deterministic financial modeling tasks.
document-converter-suite
dkyazzentwatwa/chatgpt-skills
Convert PDFs, Office docs, markdown, HTML, and tables between editable formats. Use for best-effort document conversion, PDF utilities, form filling, and table extraction.
image-enhancement-suite
dkyazzentwatwa/chatgpt-skills
Open the skill to read its SKILL.md instructions.
Popular docs & writing skills
grill-with-docs
mattpocock/skills
A relentless interview to sharpen a plan or design, which also creates docs (ADR's and glossary) as we go.
lark-markdown
open.feishu.cn
飞书 Markdown:查看、创建、上传、编辑和比较飞书中的原生 Markdown 文件。当用户要操作飞书 Markdown 文件,或比较其远端版本及本地草稿时使用。纯本地 Markdown 文件操作不触发本 skill。不负责将 Markdown 导入为飞书在线文档,也不负责文件搜索、权限、评论、移动、删除等云空间管理操作。
writing-beats
mattpocock/skills
Writing, exploit; assemble raw material into a journey of beats, grounding each term before a beat leans on it.
writing-shape
mattpocock/skills
Writing, exploit: shape raw material into an article, paragraph by paragraph.
writing-fragments
mattpocock/skills
Writing, explore: mine raw fragments, no structure yet.
writing-for-agents
mattpocock/skills
Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md.