Skip to main content

Lightweight keyword & keyphrase extraction and ranking using TF-IDF with optional embedding re-ranking.

Project description

auto-keyword-ranker

PyPI version License

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

```python
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:



```python
[('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](LICENSE) © 2025 Reya Oberoi

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

auto_keyword_ranker-0.1.2.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

auto_keyword_ranker-0.1.2-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file auto_keyword_ranker-0.1.2.tar.gz.

File metadata

  • Download URL: auto_keyword_ranker-0.1.2.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.9

File hashes

Hashes for auto_keyword_ranker-0.1.2.tar.gz
Algorithm Hash digest
SHA256 1477baa426a582d080942b352bc661dc2f6df8d0b89387570eba5302d207f237
MD5 cc24bc3f14832087367f35577df049da
BLAKE2b-256 7f3e8d7eef76f5f2a57de6c23c9a0ec12f472fdc6387734bf41c8e24fadb5695

See more details on using hashes here.

File details

Details for the file auto_keyword_ranker-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for auto_keyword_ranker-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 229ac0b6711e14cd1c22f0e44b1b00e4281cdb95d515268841a73cd8703082fa
MD5 23f95f639ab4aa2706e72efe945d8258
BLAKE2b-256 88cbc84752685f0bc9ec334e989b1b35d5a6bb005f01927f239398275f7b5040

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page