0.0
No release in over 3 years
There's a lot of open issues
Pure Ruby keyword and keyphrase extraction library. Implements RAKE, YAKE, and TF-IDF algorithms for extracting keywords from text.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 5.0
~> 13.0
 Project Readme

keyword-ruby

Keyword extraction for Ruby using RAKE, YAKE, and TF-IDF algorithms. Extract the most relevant terms from any text.

Installation

gem "keyword-ruby"

Usage

require "keyword_ruby"

text = "Ruby is a dynamic programming language focused on simplicity and productivity."

# RAKE (Rapid Automatic Keyword Extraction)
keywords = KeywordRuby.extract(text, algorithm: :rake, top_n: 5)

# YAKE (Yet Another Keyword Extractor)
keywords = KeywordRuby.extract(text, algorithm: :yake, top_n: 5)

# TF-IDF
extractor = KeywordRuby::Extractors::Tfidf.new
extractor.fit(corpus)  # optional: fit on a corpus
keywords = extractor.extract(text, top_n: 5)

keywords.each { |kw| puts "#{kw.text}: #{kw.score}" }

Features

  • RAKE with proper co-occurrence degree calculation
  • YAKE with stop word handling in multi-word phrases
  • TF-IDF with optional corpus fitting (falls back to TF-only)
  • Score normalization to 0.0-1.0 range
  • English contraction expansion (don't → do not)
  • Input validation and language support

License

MIT