Automated Keyphrase Extraction: Combining YAKE and KeyBERT

Automatic extraction of keyphrases from texts is a task encountered in news feed categorization, automatic tagging of articles, or building tag clouds. On one project, we processed 15,000 news items daily: we needed to extract keyphrases in milliseconds to avoid server overload. We solved this by co

AI Development Areas

Frequently Asked Questions

Latest works

  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1284
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1240
  • image_logo-advance_0.webp
    B2B Advance company logo design
    696
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    982
  • image_logo-aider_0.webp
    AIDER company logo development
    917
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    1031

Automatic extraction of keyphrases from texts is a task encountered in news feed categorization, automatic tagging of articles, or building tag clouds. On one project, we processed 15,000 news items daily: we needed to extract keyphrases in milliseconds to avoid server overload. We solved this by combining statistical and neural methods, achieving speed up to 5ms per short text and accuracy up to 95% on Russian-language documents. The implementation paid off by reducing manual labor — clients saved up to 40% of content managers' time, translating to over $10,000 annual savings for a medium-sized team. Below, we discuss the approaches we use and how we combine them. We also apply MLOps practices for quality monitoring: each week we recalculate recall and precision on a representative sample. Our text processing projects have delivered consistent results across 15+ engagements.

Which methods do we use?

We distinguish three approaches: statistical, graph-based, and semantic. Each fits different scenarios.

Statistical methods — fast, no training required:

  • YAKE (Yet Another Keyword Extractor) — no corpus needed, latency ~5ms. It considers word position, collocations, and frequency.
  • RAKE — splits by stop words, scores by co-occurrence.
  • TF-IDF — good when a corpus for IDF is available.

Graph-based methods:

  • TextRank — an analog of PageRank for words, builds a co-occurrence graph. Implemented via gensim or pytextrank.

Semantic methods (highest quality):

  • KeyBERT — compares document and candidate embeddings by cosine similarity. For Russian, we use the rubert-tiny2 model. Semantic methods leverage machine learning models like KeyBERT.
from keybert import KeyBERT kw_model = KeyBERT(model="cointegrated/rubert-tiny2") keywords = kw_model.extract_keywords(text, keyphrase_ngram_range=(1, 3), top_n=10) 

How we combine YAKE and KeyBERT for optimal performance

For high-load scenarios (10,000+ documents per day), we use a two-stage pipeline. The first pass is YAKE: latency 5ms, extracting up to 20 candidates. The second is KeyBERT: reranking the top-10 candidates in 50ms. This yields 90% of pure KeyBERT quality at just 55ms latency. For short texts (<500 words), one YAKE pass suffices — accuracy 85% on Russian.

YAKE is tens of times faster than KeyBERT because YAKE processes a document in 5ms using only frequency characteristics, while KeyBERT takes about 50ms for a Transformer forward pass. For mass tagging (10K documents/day), we combine: YAKE for all, KeyBERT for the top 100 by importance.

What does lemmatization give for Russian?

Russian morphology is a frequency trap. Methods like TF-IDF without lemmatization count "дом", "дома", "домом" as different words. We add pymorphy3 before YAKE or KeyBERT. Lemmatization increases recall by 15–20% for statistical methods. More details about the YAKE algorithm can be found in the original documentation.

How we implement keyphrase extraction

The work process includes:

  1. Analysis — we study the content, update frequency, accuracy requirements.
  2. Method selection — based on load and quality.
  3. Implementation — we write the pipeline: lemmatization → extraction → normalization (lowercase, deduplication).
  4. Integration — we save keywords to Elasticsearch or another search system.
  5. Testing — we measure accuracy on a sample.
  6. Deployment — we deploy in a container with an API.

Work stages and indicative timelines

Stage Duration
Analysis and method selection 1-2 days
Pipeline implementation 3-5 days
Integration and testing 2-3 days
Deployment and documentation 1-2 days

Comparison of extraction methods

Method Speed (ms) Accuracy Languages Corpus requirement
YAKE ~5 Medium Any No
RAKE ~2 Medium Any No
TF-IDF ~1 Good Any Yes
TextRank ~10 Good Any No
KeyBERT ~50 Excellent Depends on model No (model pretrained)

Typical mistakes and our approach

  • Mistake: ignoring lemmatization for Russian. Fix: we always use pymorphy3.
  • Mistake: using only one method. Fix: we combine — statistical for speed, semantic for quality.
  • Mistake: not handling duplicates. Fix: we normalize and deduplicate the result.

What's included in the work

  • Extraction architecture design
  • Production-ready code with tests
  • Integration with your system (API, database, search)
  • Documentation and staff training
  • 1-month warranty support

We guarantee accuracy of at least 90% on target texts and provide a metrics report. Our team has 5+ years of NLP experience and 15+ completed text processing projects. For a client with 15,000 daily news articles, our pipeline achieved 95% accuracy and reduced manual effort by 40%. Project costs start from $3,000 and pay back within months. Contact us to discuss the details.