Skip to main content

auto-keyword-ranker

PyPI version License

A lightweight Python library to automatically extract and rank the most relevant keywords and keyphrases from text.

Goal: Provide a single-line call to obtain ranked keywords for articles, blog posts, or short documents. Uses TF-IDF by default, with optional re-ranking via sentence-transformer embeddings.


Installation

pip install auto-keyword-ranker

With optional embedding-based re-ranking:

pip install auto-keyword-ranker[embed]

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.
Companies across healthcare, finance, and manufacturing are investing heavily in AI
to automate decision-making, enhance efficiency, and unlock new insights from
large datasets.
"""

# Simple TF-IDF keyword ranking
keywords = rank_keywords(text, top_n=10)
print(keywords)

Output

A list of (keyword, score) pairs, for example:

[('new', 0.25),
 ('vision advanced', 0.12),
 ('unlock new', 0.12),
 ('unlock', 0.12),
 ('transforming industries', 0.12),
 ('vision', 0.12),
 ('transforming', 0.12),
 ('processing computer', 0.12),
 ('new insights', 0.12),
 ('processing', 0.12)]

Example Bar Chart


API

rank_keywords(
    texts,
    top_n=10,
    method='tfidf',
    ngram_range=(1,2),
    stop_words=True,
    use_embeddings=False,
    embedding_model=None,
    combine_score_alpha=0.6
)

See docstrings in core.py for full parameter descriptions.


CLI

You can also run the CLI (after installation):

python -m autokeyword.cli --text "Your article text here" --top 10

How It Works

TF-IDF scoring formula:

$$ \text{TF-IDF}(t, d) = \text{TF}(t, d) \times \log \frac{N}{1 + \text{DF}(t)} $$

Where:

  • ( t ) = term
  • ( d ) = document
  • ( N ) = total number of documents

Use Cases

  • SEO keyword extraction for blog posts
  • Automatic tagging in content management systems
  • Quick summarization of research papers
  • Preprocessing for search or recommendation engines

License

MIT License © 2025 Reya Oberoi

Metadata

Release files for auto-keyword-ranker 0.1.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for auto-keyword-ranker 0.1.10
File Size Uploaded Provenance Actions
auto_keyword_ranker-0.1.10.tar.gz 5.9 kB Without provenance Details for auto_keyword_ranker-0.1.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for auto-keyword-ranker 0.1.10
File Interpreter ABI Platform Actions
auto_keyword_ranker-0.1.10-py3-none-any.whl Python 3 none any Details for auto_keyword_ranker-0.1.10-py3-none-any.whl

Total release size: 12.4 kB

Release files / auto_keyword_ranker-0.1.10.tar.gz

Download URL auto_keyword_ranker-0.1.10.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
beefaa87f818a1e2233c1d89824338d4dd8e128ebac3624d9c22f053133e73d9
BLAKE2b-256 checksum
How to use checksums
e47b748634eb3cc5d1487f389ca4daaff44f99989f959d0b1f55cf2651e1e9a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.9

Release files / auto_keyword_ranker-0.1.10-py3-none-any.whl

Download URL auto_keyword_ranker-0.1.10-py3-none-any.whl
Size 6.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b9d707526529e754933156e3712b56da683d6f6d84cc5ece3eb7b7b9b4aa6752
BLAKE2b-256 checksum
How to use checksums
3700b1de56d31a057c5541f4e96a62acd2421c269bbd108969d826cacff3dfb2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.9

Security for auto-keyword-ranker 0.1.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page