Skip to content
A minimalist generative grammar library
Ruby Shell
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci
bin
lib
spec
.gitignore
.rspec
.rubocop.yml
Gemfile
LICENSE.txt
README.md
Rakefile
wordz.gemspec

README.md

Gem Version Build Maintainability

Wordz

A minimalist generative grammar library. For use in bots and other mischief.

Usage

grammar = {
  "<root>" => [
    ["#dog#name#", "says", "<bark>", "."],
  ],
  "<bark>" => [
    ["ruff"],
    ["woof"],
  ]
}

class Dog
  def name
    "Daisy"
  end
end

Wordz.generate(
  grammar: grammar,
  subjects: { dog: Dog.new },
)

# Will return one of the following, at random.
# => "Daisy says ruff."
# => "Daisy says arf." 
You can’t perform that action at this time.