Giter Club home page Giter Club logo

markovinator's Introduction

markovinator

Markov chain string generation module for Python. Works with Python 2.7 only.

Adding this module to your project

Add the markovinator.py file to the same directory your project is located in. Then import:

from markovinator import Markovinator

How to use this module

Simply create an instance of the Markovinator class, passing the sample string as input. Then call on the object's generate_sentence() method or generate_paragraph() method to generate a pseudo-random string based on that input.

Example program:

markov = Markovinator("The quick brown fox jumps over the lazy dog.")
print markov.generate_sentence()

You can control how many sentences to generate using the generate_paragraph() method by passing it as an input parameter, e.g.:

print markov.generate_paragraph(6) # prints a paragraph 6 sentences long

You can add to and change the sample input as well:

markov.add_input("This input will add to the previous input.")

The add_input() add to the previously existing input. Alternatively, you can replace the current input with a new set of input text using the refresh_input() method.

markov.refresh_input("This input will replace the previous input.")

markovinator's People

Contributors

cp2846 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.