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.

Install

Core (TF-IDF only):

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)}
$$

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  see LICENSE file.

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.1.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.1-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: auto_keyword_ranker-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 46b14f6e91575f6d2d525b6f7c73b1078ddf10635e5245e1194392ea36f83cc6
MD5 544168f5fd7f1d56b9edf62fe04224cc
BLAKE2b-256 40b1fd15a058472132fbae5a1678e87caf1fbabf5b010cbd22f4008fe278ace0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for auto_keyword_ranker-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 94e07e69b816354c1ff09e46cc7cf8cd80e628e9e75156e781bd1f024f6c9554
MD5 e595d8058003e2a5bff2ae1acefe258d
BLAKE2b-256 b161b09920afe6bdb6c0675d0b8fdfe05bf4a6230e1a552c06e1af4f3f6c76bf

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