--- id: keybert version: "0.9.0" 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) license_treatment: permissive maintenance: active --- # keybert — KeyBERT performs keyword extraction with state-of-the-art transformer models. License: permissive · Maintenance: active · Downloads: 720.9K/mo ## 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 above — 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 pip install keybert uv add keybert 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_current - Install friction: low - Maintenance: active - Downloads: 720.9K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags keyword extraction with BERT, automatic keyphrase extraction, document keyword mining, semantic keyword extraction, transformer-based keyword extraction, embedding-based keyword extraction, extract keywords from text, NLP keyword identification, nlp, embeddings, information-extraction [View on SkillFed](https://skillfed.io/packages/keybert) · [View on PyPI](https://pypi.org/project/keybert/)