Vidibus::Words
This gem provides handling of words. It ships with a list of stop words in English, German, and Spanish and allows extraction of keywords from a string.
This gem is part of Vidibus, an open source toolset for building distributed (video) applications.
Installation
Add gem 'vidibus-words'
to your Gemfile
. Then call bundle install
on your console.
Usage
To return a list of keywords from a given text, ordered by occurrence, enter:
input = Vidibus::Words.new('To tell a long story short, it\'s necessary to tell it briefly without fluff!')
input.keywords
=> ["tell", "long", "story", "short", "necessary", "briefly", "fluff"]
To return keywords of a certain locale only, you may set it as filter:
input = Vidibus::Words.new('To tell a long story short, it\'s necessary to tell it briefly without fluff!')
input.locale = :de
input.keywords
=> ["to", "tell", "a", "long", "story", "short", "it's", "necessary", "it", "briefly", "without", "fluff"]
Stopwords lists
You may obtain stopwords easily:
Vidibus::Words.stopwords
Vidibus::Words.stopwords(:en)
Copyright
© 2010-2012 Andre Pankratz. See LICENSE for details.