Rword is a ruby gem that generates all possible english words from a set of letters and a specified limit.
Add this line to your application's Gemfile:
gem 'rword'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install rword
require 'rword'
robin = Rword.generate('robin', 3, true)
# => ["rob", "orb", "nor", "obi", "rib", "bio", "bon", "ion", "bin", "nib"]
The method returns an array of words found.
Parameter 1: Letters (String, Required) -The letters that the words are going to be generated from. Can be a word or a random set of letters.
Parameter 2: Limit (Integer, Required) -The length of words that are to be generated.
Parameter 3: English words only? (Boolean, Optional, Default: True) -Whether to generate english words only or all set of letters possible
$ rword robin 3 true
rob
orb
nor
obi
rib
bio
bon
ion
bin
nib
Arguments are similar to the input parameters.
Bug reports and pull requests are welcome on GitHub at https://github.com/robincheptileh/rword. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the Rword project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.