Lightweight keyword & keyphrase extraction and ranking using TF-IDF with optional embedding re-ranking.
Project description
auto-keyword-ranker
Lightweight Python package to extract and rank the most relevant keywords and keyphrases from text.
Goal: One-line call to get ranked keywords for articles, blog posts, or short documents.
Core approach uses TF-IDF; optional re-ranking with sentence-transformer embeddings.
Installation
pip install auto-keyword-ranker
Quickstart
from autokeyword import rank_keywords
text = """
Artificial intelligence is transforming industries by enabling new capabilities
such as natural language processing, computer vision, and advanced data analytics.
"""
# Simple TF-IDF keyword ranking
keywords = rank_keywords(text, top_n=5)
print(keywords)
Output
A list of (keyword, score) pairs, for example:
[('artificial intelligence', 0.42),
('data analytics', 0.33),
('natural language processing', 0.29),
('computer vision', 0.25),
('industries', 0.21)]
How It Works TF-IDF scoring formula:
$$ \mathrm{TF!-!IDF}(t,d)=\mathrm{TF}(t,d)\times \log \frac{N}{1+\mathrm{DF}(t)} $$
Where:
TF(t, d) – term frequency of term t in document d
DF(t) – number of documents containing term t
N – total number of documents
License
MIT License © 2025 Reya Oberoi
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file auto_keyword_ranker-0.1.3.tar.gz.
File metadata
- Download URL: auto_keyword_ranker-0.1.3.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3641b58d9d1cb69930c32cc6ec807e4e9166cf5c47db6d62639dc1becad96cdf
|
|
| MD5 |
40240b943ddac17c864134b7aa6a6f8a
|
|
| BLAKE2b-256 |
6c4bff985781825fc44d2f3b0d12ffa84cb2da09cd3d2db55d8b905174f56307
|
File details
Details for the file auto_keyword_ranker-0.1.3-py3-none-any.whl.
File metadata
- Download URL: auto_keyword_ranker-0.1.3-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e356652eb99fddb37211eb8bfe757e1e8f02d2a02713796f14ef040469352ff5
|
|
| MD5 |
d003b5983d497c482f00a1f1c09163ae
|
|
| BLAKE2b-256 |
95f5b7fa61f861fe357650a909e51a3f12406b6be6468d37cc9de6920ded8abf
|