skillfed

keybert

KeyBERT performs keyword extraction with state-of-the-art transformer models.

keybert v0.9.0 720.9K downloads/30d#5,232 on PyPI4,215
Permissive license MIT License Copyright (c) 2020, Maarten P. Grootendorst Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the… (full text in the JSON record) Active released

What it is and what it does

KeyBERT is a lightweight keyword extraction library that uses pre-trained BERT embeddings to identify the words and phrases in a document that best represent its semantic content. It works by computing a document-level embedding, then embedding candidate n-grams, and ranking them by cosine similarity to the document. The library requires four runtime dependencies: numpy and scikit-learn for numerical operations, sentence-transformers to load and run embedding models, and rich for output formatting.

The package is designed for minimal setup. It supports multiple extraction strategies, configurable n-gram ranges, and pluggable embedding backends. It is actively maintained, supports Python 3.8, 3.9, 3.10, 3.11, and 3.12, and has no known security vulnerabilities.

Use it for:

  • Extract single-word keywords from research papers or articles to build document summaries or search indices.
  • Generate multi-word keyphrases from product descriptions or customer feedback to identify key topics.
  • Diversify keyword results using maximal marginal relevance to avoid redundant or near-duplicate extractions.
  • Build a document tagger by extracting keywords and using them to label or categorize incoming text.
  • Integrate semantic keyword extraction into a content recommendation system to match documents by extracted terms.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

KeyBERT extracts keywords and keyphrases from documents by computing BERT embeddings and finding n-grams most similar to the document as a whole using cosine similarity.

Yes. KeyBERT is worth installing for semantic keyword extraction tasks. It has low install friction, active maintenance, permissive licensing, no known vulnerabilities, and a straightforward API. The main consideration is that sentence-transformers downloads a transformer model on first use; verify that the model can be pre-cached and that extraction latency meets your needs.

Install

keybert on PyPI

pip

pip install keybert

uv

uv add keybert

poetry

poetry add keybert

Installing keybert

Before you install

Low install friction: pure Python wheel with four runtime dependencies (numpy, scikit-learn, sentence-transformers, rich). Actively maintained with recent commits and no known vulnerabilities.

License in practice

MIT License permits commercial and private use, modification, and redistribution with minimal restrictions—suitable for most projects.

Quickstart

pip install keybert

from keybert import KeyBERT

kw_model = KeyBERT()
keywords = kw_model.extract_keywords(doc)

sentence-transformers downloads a transformer model on first use; requires internet access or pre-cached model.

Verify before relying

  • Whether the package works offline after initial model download, or requires network access per extraction call.
  • Memory footprint and latency characteristics for large documents or batch processing.
  • Whether optional extras (flair, gensim, spacy, use) are required for production use or only for advanced embedding backends.
  • Performance characteristics and typical extraction latency on standard document sizes.

Package facts

License MIT License Copyright (c) 2020, Maarten P. Grootendorst Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the… (full text in the JSON record) (permissive)
Python support supports the current Python release (>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies 4 — numpy, rich, scikit-learn, sentence-transformers
Maintenance actively maintained — 553 days since the last release
Last repo commit
First released
Downloads 720,941/month — #5,232 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: keybert-0.9.0-py3-none-any.whl

Keywords: nlp, bert, keyword, extraction, embeddings

Intended Audience :: DevelopersIntended Audience :: Science/ResearchLicense :: OSI Approved :: MIT LicenseOperating System :: MacOSOperating System :: Microsoft :: WindowsOperating System :: POSIXOperating System :: UnixProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Scientific/EngineeringTopic :: Scientific/Engineering :: Artificial Intelligence

Tags

keyword extraction with BERTautomatic keyphrase extractiondocument keyword miningsemantic keyword extractiontransformer-based keyword extractionembedding-based keyword extractionextract keywords from textNLP keyword identification
nlpembeddingsinformation-extraction

More Scientific/Engineering packages