0.0
No commit activity in last 3 years
No release in over 3 years
A gem to generate text. At the moment, the only method available is a Markov Model Generator, but more are to come later.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.7
~> 10.0

Runtime

 Project Readme

TextGenerator

A gem to automatically generate text, using various schemes. At the moment, the only scheme available is a Markov-like algorithm, but more are to come soon.

Installation

Add this line to your application's Gemfile:

gem 'text_generator'

And then execute:

$ bundle

Or install it yourself as:

$ gem install text_generator

Usage

Markov Generator

Three simple steps:

First you need to initiate a new generator. The default values are an ngram of size 1 and a maximum length of text generated of 15 words. Play with those value to get the best results depending on your source text.

generator = MarkovGenerator.new(n = 1, genmax = 15)

Second you need to feed the generator some source text for it to be able to output something original later.

generator.feed(line)

Finally, generate a brand new piece of text, unknown until now to all humanity, past, present and future.

generator.generate

Voila.

Contributing

  1. Fork it ( https://github.com/[my-github-username]/text_generator/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request